@@ -250,7 +250,7 @@ public void Test_ServiceStack_Text_JsonSerializer_Array_Value_Deserializes_Corre
250
250
}
251
251
252
252
[ Test ]
253
- public void deserizes_to_decimal_by_default ( )
253
+ public void Deserializes_to_decimal_by_default ( )
254
254
{
255
255
JsConfig . TryToParsePrimitiveTypeValues = true ;
256
256
@@ -279,7 +279,7 @@ public NumericType(decimal min, decimal max, Type type)
279
279
}
280
280
281
281
[ Test ]
282
- public void deserizes_signed_bytes_into_to_best_fit_numeric ( )
282
+ public void Deserializes_signed_bytes_into_to_best_fit_numeric ( )
283
283
{
284
284
JsConfig . TryToParsePrimitiveTypeValues = true ;
285
285
JsConfig . TryToParseNumericType = true ;
@@ -292,16 +292,18 @@ public void deserizes_signed_bytes_into_to_best_fit_numeric()
292
292
Assert . That ( deserializedDict [ "max" ] , Is . EqualTo ( sbyte . MaxValue ) ) ;
293
293
}
294
294
295
+ #if NETFX
295
296
[ Test ]
296
- public void deserizes_floats_into_to_best_fit_floating_point ( )
297
+ public void Deserializes_floats_into_to_best_fit_floating_point ( )
297
298
{
298
299
JsConfig . TryToParsePrimitiveTypeValues = true ;
299
300
JsConfig . TryToParseNumericType = true ;
300
301
JsConfig . ParsePrimitiveFloatingPointTypes = ParseAsType . Single | ParseAsType . Double ;
301
302
302
303
float floatValue = 1.1f ;
303
304
//TODO find a number that doesn't suck which throws in float.Parse() but not double.Parse()
304
- double doubleValue = double . MaxValue - Math . Pow ( 2 , 1000 ) ;
305
+ double Offset = Math . Pow ( 2 , 1000 ) ;
306
+ double doubleValue = double . MaxValue - Offset ;
305
307
var intValue = int . MaxValue ;
306
308
var longValue = long . MaxValue ;
307
309
@@ -311,17 +313,17 @@ public void deserizes_floats_into_to_best_fit_floating_point()
311
313
var toFloatValue = float . Parse ( floatValue . ToString ( ) ) ;
312
314
Assert . AreEqual ( toFloatValue , floatValue , 1 ) ;
313
315
var toDoubleValue = double . Parse ( doubleValue . ToString ( ) ) ;
314
- Assert . AreEqual ( toDoubleValue , doubleValue , Math . Pow ( 2 , 1000 ) ) ;
316
+ Assert . AreEqual ( toDoubleValue , doubleValue , Offset ) ;
315
317
316
318
var json = "{{\" float\" :{0},\" double\" :{1},\" int\" :{2},\" long\" :{3}}}"
317
319
. Fmt ( CultureInfo . InvariantCulture , floatValue , doubleValue , intValue , longValue ) ;
318
320
var map = JsonSerializer . DeserializeFromString < IDictionary < string , object > > ( json ) ;
319
321
320
322
Assert . That ( map [ "float" ] , Is . TypeOf < float > ( ) ) ;
321
323
Assert . That ( map [ "float" ] , Is . EqualTo ( floatValue ) ) ;
322
-
324
+
323
325
Assert . That ( map [ "double" ] , Is . TypeOf < double > ( ) ) ;
324
- Assert . AreEqual ( ( double ) map [ "double" ] , doubleValue , Math . Pow ( 2 , 1000 ) ) ;
326
+ Assert . AreEqual ( ( double ) map [ "double" ] , doubleValue , Offset ) ;
325
327
326
328
Assert . That ( map [ "int" ] , Is . TypeOf < int > ( ) ) ;
327
329
Assert . That ( map [ "int" ] , Is . EqualTo ( intValue ) ) ;
@@ -331,9 +333,10 @@ public void deserizes_floats_into_to_best_fit_floating_point()
331
333
332
334
JsConfig . Reset ( ) ;
333
335
}
336
+ #endif
334
337
335
338
[ Test ]
336
- public void deserizes_signed_types_into_to_best_fit_numeric ( )
339
+ public void Deserializes_signed_types_into_to_best_fit_numeric ( )
337
340
{
338
341
var unsignedTypes = new [ ]
339
342
{
@@ -365,7 +368,7 @@ public void deserizes_signed_types_into_to_best_fit_numeric()
365
368
}
366
369
367
370
[ Test ]
368
- public void deserizes_unsigned_types_into_to_best_fit_numeric ( )
371
+ public void Deserializes_unsigned_types_into_to_best_fit_numeric ( )
369
372
{
370
373
var unsignedTypes = new [ ]
371
374
{
0 commit comments