File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,23 @@ public void TestFallBack()
384
384
Assert . AreEqual ( "False" , ( expr as UnknownExpression ) ? . Type ) ;
385
385
}
386
386
387
+ [ Test ]
388
+ public void TestFallBackGeneric ( )
389
+ {
390
+ var settings = new JsonSerializerSettings ( ) ;
391
+ JsonConvert . DefaultSettings = ( ) => settings ;
392
+
393
+ settings . Converters . Add ( JsonSubtypesConverterBuilder
394
+ . Of ( typeof ( IExpression ) , "Type" )
395
+ . SetFallbackSubtype < UnknownExpression > ( )
396
+ . RegisterSubtype ( typeof ( ConstantExpression ) , "Constant" )
397
+ . Build ( ) ) ;
398
+
399
+ var expr = JsonConvert . DeserializeObject < IExpression > ( "{\" Type\" : \" False\" }" ) ;
400
+
401
+ Assert . AreEqual ( "False" , ( expr as UnknownExpression ) ? . Type ) ;
402
+ }
403
+
387
404
[ Test ]
388
405
public void TestFallBackWithNullRegistered ( )
389
406
{
Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ public JsonSubtypesConverterBuilder SetFallbackSubtype(Type fallbackSubtype)
78
78
return this ;
79
79
}
80
80
81
- public JsonSubtypesConverterBuilder SetFallbackSubtype < T > ( object value )
81
+ public JsonSubtypesConverterBuilder SetFallbackSubtype < T > ( )
82
82
{
83
- return RegisterSubtype ( typeof ( T ) , value ) ;
83
+ return SetFallbackSubtype ( typeof ( T ) ) ;
84
84
}
85
85
86
86
public JsonConverter Build ( )
You can’t perform that action at this time.
0 commit comments