@@ -234,11 +234,12 @@ public void Can_deserialize_json_with_underscores()
234234 }
235235 }
236236
237- public class CustomSerailizerValueTypeTests
237+ public class CustomSerailizerValueTypeTests
238238 {
239- [ Ignore ( "Need to clear static element caches" ) , Test ]
239+ [ Ignore ( "Needs to clear dirty static element caches from other tests " ) , Test ]
240240 public void Can_serialize_custom_doubles ( )
241241 {
242+ JsConfig < double > . IncludeDefaultValue = true ;
242243 JsConfig < double > . RawSerializeFn = d =>
243244 double . IsPositiveInfinity ( d ) ?
244245 "\" +Inf\" "
@@ -251,6 +252,11 @@ public void Can_serialize_custom_doubles()
251252 var doubles = new [ ] { 0.0 , 1.0 , double . NegativeInfinity , double . NaN , double . PositiveInfinity } ;
252253
253254 Assert . That ( doubles . ToJson ( ) , Is . EqualTo ( "[0,1,\" -Inf\" ,\" NaN\" ,\" +Inf\" ]" ) ) ;
255+
256+ Assert . That ( new KeyValuePair < double , double > ( 0 , 1 ) . ToJson ( ) ,
257+ Is . EqualTo ( "{\" Key\" :0,\" Value\" :1}" ) ) ;
258+
259+ JsConfig . Reset ( ) ;
254260 }
255261
256262 public class Model
@@ -261,13 +267,16 @@ public class Model
261267 [ Test ]
262268 public void Can_serialize_custom_ints ( )
263269 {
264- JsConfig < int > . IncludeDefaultValue = true ;
270+ // JsConfig<int>.IncludeDefaultValue = true;
265271 JsConfig < int > . RawSerializeFn = i =>
266272 i == 0 ? "-1" : i . ToString ( ) ;
267273
268274 var dto = new Model { Int = 0 } ;
269275
270- Assert . That ( dto . ToJson ( ) , Is . EqualTo ( "{\" Int\" :-1}" ) ) ;
276+ using ( JsConfig . With ( includeNullValues : true ) )
277+ {
278+ Assert . That ( dto . ToJson ( ) , Is . EqualTo ( "{\" Int\" :-1}" ) ) ;
279+ }
271280
272281 JsConfig . Reset ( ) ;
273282 }
0 commit comments