@@ -18,7 +18,7 @@ public AbbreviatedUnitsConverterTests() : base(new AbbreviatedUnitsConverter())
18
18
public void DoubleQuantity_SerializedWithDoubleValueAndAbbreviatedUnit ( )
19
19
{
20
20
var quantity = new Mass ( 1.20 , MassUnit . Milligram ) ;
21
- var expectedJson = "{ \ " Value\ " :1.2,\ " Unit\" : \ " mg\" , \ " Type\" : \ " Mass\" } " ;
21
+ var expectedJson = """{ "Value":1.2,"Unit": "mg", "Type": "Mass"}"" " ;
22
22
23
23
var json = SerializeObject ( quantity ) ;
24
24
@@ -40,7 +40,7 @@ public void DecimalQuantity_SerializedWithDecimalValueAndAbbreviatedUnit()
40
40
public void InterfaceObject_IncludesTypeInformation ( )
41
41
{
42
42
var testObject = new TestInterfaceObject { Quantity = new Information ( 1.20m , InformationUnit . Exabyte ) } ;
43
- var expectedJson = "{ \ " Quantity\ " :{\ " Value\ " :1.20, \ " Unit\" : \ " EB\" , \ " Type\" : \ " Information\ " }}" ;
43
+ var expectedJson = """{ "Quantity":{"Value":1.2, "Unit": "EB", "Type": "Information"}}"" " ;
44
44
45
45
var json = SerializeObject ( testObject ) ;
46
46
@@ -52,7 +52,7 @@ public void InterfaceObject_SerializesWithoutKnownTypeInformation()
52
52
{
53
53
var testObject = new TestInterfaceObject { Quantity = new Volume ( 1.2 , VolumeUnit . Microliter ) } ;
54
54
55
- var expectedJson = "{ \ " Quantity\ " :{\ " Value\ " :1.2,\ " Unit\" : \ " µl\" , \ " Type\" : \ " Volume\ " }}" ;
55
+ var expectedJson = """{ "Quantity":{"Value":1.2,"Unit": "µl", "Type": "Volume"}}"" " ;
56
56
57
57
var json = SerializeObject ( testObject ) ;
58
58
@@ -66,7 +66,7 @@ public void InterfaceObject_SerializesWithoutKnownTypeInformation()
66
66
[ Fact ]
67
67
public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit ( )
68
68
{
69
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " mg\" , \ " Type\" : \ " Mass\" } " ;
69
+ var json = """{ "Value":1.2,"Unit": "mg", "Type": "Mass"}"" " ;
70
70
71
71
var quantity = DeserializeObject < IQuantity > ( json ) ;
72
72
@@ -77,7 +77,7 @@ public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit()
77
77
[ Fact ]
78
78
public void DoubleQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit ( )
79
79
{
80
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " mg\" } " ;
80
+ var json = """{ "Value":1.2,"Unit": "mg"}"" " ;
81
81
82
82
var quantity = DeserializeObject < Mass > ( json ) ;
83
83
@@ -88,7 +88,7 @@ public void DoubleQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit()
88
88
[ Fact ]
89
89
public void DoubleIQuantity_DeserializedFromDoubleValueAndNonAmbiguousAbbreviatedUnit_WithoutQuantityType ( )
90
90
{
91
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " em\" } " ;
91
+ var json = """{ "Value":1.2,"Unit": "em"}"" " ;
92
92
93
93
var quantity = DeserializeObject < Mass > ( json ) ;
94
94
@@ -99,15 +99,15 @@ public void DoubleIQuantity_DeserializedFromDoubleValueAndNonAmbiguousAbbreviate
99
99
[ Fact ]
100
100
public void ThrowsAmbiguousUnitParseException_WhenDeserializingAmbiguousAbbreviation_WithoutQuantityType ( )
101
101
{
102
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " mg\" } " ;
102
+ var json = """{ "Value":1.2,"Unit": "mg"}"" " ;
103
103
104
104
Assert . Throws < AmbiguousUnitParseException > ( ( ) => DeserializeObject < IQuantity > ( json ) ) ;
105
105
}
106
106
107
107
[ Fact ]
108
108
public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit_CaseInsensitive ( )
109
109
{
110
- var json = "{ \ " value\ " :1.2,\ " unit\" : \ " Mg\" , \ " type\" : \ " mass\" } " ;
110
+ var json = """{ "value":1.2,"unit": "Mg", "type": "mass"}"" " ;
111
111
112
112
var quantity = DeserializeObject < IQuantity > ( json ) ;
113
113
@@ -118,7 +118,7 @@ public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit_CaseIn
118
118
[ Fact ]
119
119
public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit_CaseSensitiveUnits ( )
120
120
{
121
- var json = "{ \ " value\ " :1.2,\ " unit\" : \ " Mbar\" , \ " type\" : \ " pressure\" } " ;
121
+ var json = """{ "value":1.2,"unit": "Mbar", "type": "pressure"}"" " ;
122
122
123
123
var megabar = DeserializeObject < IQuantity > ( json ) ;
124
124
var millibar = DeserializeObject < IQuantity > ( json . ToLower ( ) ) ;
@@ -132,23 +132,23 @@ public void DoubleIQuantity_DeserializedFromDoubleValueAndAbbreviatedUnit_CaseSe
132
132
[ Fact ]
133
133
public void UnitsNetExceptionThrown_WhenDeserializing_FromUnknownQuantityType ( )
134
134
{
135
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " mg\" , \ " Type\" : \ " invalid\" } " ;
135
+ var json = """{ "Value":1.2,"Unit": "mg", "Type": "invalid"}"" " ;
136
136
137
137
Assert . Throws < UnitsNetException > ( ( ) => DeserializeObject < Mass > ( json ) ) ;
138
138
}
139
139
140
140
[ Fact ]
141
141
public void UnitsNotFoundExceptionThrown_WhenDeserializing_FromUnknownUnit ( )
142
142
{
143
- var json = "{ \ " Value\ " :1.2,\ " Unit\" : \ " invalid\" , \ " Type\" : \ " Mass\" } " ;
143
+ var json = """{ "Value":1.2,"Unit": "invalid", "Type": "Mass"}"" " ;
144
144
145
145
Assert . Throws < UnitNotFoundException > ( ( ) => DeserializeObject < Mass > ( json ) ) ;
146
146
}
147
147
148
148
[ Fact ]
149
149
public void DoubleIQuantity_DeserializedFromQuotedDoubleValueAndAbbreviatedUnit ( )
150
150
{
151
- var json = "{ \ " Value\" : \ " 1.2\" , \ " Unit\" : \ " mg\" , \ " Type\" : \ " Mass\" } " ;
151
+ var json = """{ "Value": "1.2", "Unit": "mg", "Type": "Mass"}"" " ;
152
152
153
153
var quantity = DeserializeObject < IQuantity > ( json ) ;
154
154
@@ -159,7 +159,7 @@ public void DoubleIQuantity_DeserializedFromQuotedDoubleValueAndAbbreviatedUnit(
159
159
[ Fact ]
160
160
public void DoubleQuantity_DeserializedFromQuotedDoubleValueAndAbbreviatedUnit ( )
161
161
{
162
- var json = "{ \ " Value\" : \ " 1.2\" , \ " Unit\" : \ " mg\" } " ;
162
+ var json = """{ "Value": "1.2", "Unit": "mg"}"" " ;
163
163
164
164
var quantity = DeserializeObject < Mass > ( json ) ;
165
165
@@ -170,7 +170,7 @@ public void DoubleQuantity_DeserializedFromQuotedDoubleValueAndAbbreviatedUnit()
170
170
[ Fact ]
171
171
public void DoubleZeroIQuantity_DeserializedFromAbbreviatedUnitAndNoValue ( )
172
172
{
173
- var json = "{ \ " Unit\" : \ " mg\" , \ " Type\" : \ " Mass\" } " ;
173
+ var json = """{ "Unit": "mg", "Type": "Mass"}"" " ;
174
174
175
175
var quantity = DeserializeObject < IQuantity > ( json ) ;
176
176
@@ -181,7 +181,7 @@ public void DoubleZeroIQuantity_DeserializedFromAbbreviatedUnitAndNoValue()
181
181
[ Fact ]
182
182
public void DoubleZeroQuantity_DeserializedFromAbbreviatedUnitAndNoValue ( )
183
183
{
184
- var json = "{ \ " Unit\" : \ " mg\" } " ;
184
+ var json = """{ "Unit": "mg"}"" " ;
185
185
186
186
var quantity = DeserializeObject < Mass > ( json ) ;
187
187
@@ -192,7 +192,7 @@ public void DoubleZeroQuantity_DeserializedFromAbbreviatedUnitAndNoValue()
192
192
[ Fact ]
193
193
public void DoubleBaseUnitQuantity_DeserializedFromValueAndNoUnit ( )
194
194
{
195
- var json = "{ \ " Value\ " :1.2,\ " Type\" : \ " Mass\" } " ;
195
+ var json = """{ "Value":1.2,"Type": "Mass"}"" " ;
196
196
197
197
var quantity = DeserializeObject < IQuantity > ( json ) ;
198
198
@@ -203,7 +203,7 @@ public void DoubleBaseUnitQuantity_DeserializedFromValueAndNoUnit()
203
203
[ Fact ]
204
204
public void DoubleBaseUnitIQuantity_DeserializedFromValueAndNoUnit ( )
205
205
{
206
- var json = "{ \ " Value\ " :1.2}" ;
206
+ var json = """{ "Value":1.2}"" " ;
207
207
208
208
var quantity = DeserializeObject < Mass > ( json ) ;
209
209
@@ -214,7 +214,7 @@ public void DoubleBaseUnitIQuantity_DeserializedFromValueAndNoUnit()
214
214
[ Fact ]
215
215
public void DoubleZeroBaseIQuantity_DeserializedFromQuantityTypeOnly ( )
216
216
{
217
- var json = "{ \ " Type\" : \ " Mass\" } " ;
217
+ var json = """{ "Type": "Mass"}"" " ;
218
218
219
219
var quantity = DeserializeObject < IQuantity > ( json ) ;
220
220
@@ -284,7 +284,7 @@ public void DecimalQuantity_DeserializedFromQuotedDecimalValueAndAbbreviatedUnit
284
284
[ Fact ]
285
285
public void DecimalZeroIQuantity_DeserializedFromAbbreviatedUnitAndNoValue ( )
286
286
{
287
- var json = "{ \ " Unit\" : \ " EB\" , \ " Type\" : \ " Information\" } " ;
287
+ var json = """{ "Unit": "EB", "Type": "Information"}"" " ;
288
288
289
289
var quantity = ( Information ) DeserializeObject < IQuantity > ( json ) ;
290
290
@@ -295,7 +295,7 @@ public void DecimalZeroIQuantity_DeserializedFromAbbreviatedUnitAndNoValue()
295
295
[ Fact ]
296
296
public void DecimalZeroQuantity_DeserializedFromAbbreviatedUnitAndNoValue ( )
297
297
{
298
- var json = "{ \ " Unit\" : \ " EB\" } " ;
298
+ var json = """{ "Unit": "EB"}"" " ;
299
299
300
300
var quantity = DeserializeObject < Information > ( json ) ;
301
301
@@ -330,7 +330,7 @@ public void DecimalBaseUnitQuantity_DeserializedFromDecimalValueAndNoUnit()
330
330
[ Fact ]
331
331
public void DecimalZeroBaseIQuantity_DeserializedFromQuantityTypeOnly ( )
332
332
{
333
- var json = "{ \ " Type\" : \ " Information\" } " ;
333
+ var json = """{ "Type": "Information"}"" " ;
334
334
335
335
var quantity = ( Information ) DeserializeObject < IQuantity > ( json ) ;
336
336
0 commit comments