88using System . Text . RegularExpressions ;
99using NUnit . Framework ;
1010using System . Linq ;
11+ using System . Runtime . Serialization ;
1112
1213namespace ServiceStack . Text . Tests . JsonTests
1314{
@@ -211,6 +212,9 @@ public void Can_deserialise_polymorphic_list()
211212
212213#if ! IOS
213214 [ Test ]
215+ #if NETCORE
216+ [ Ignore ( ".NET Core does not allow to find types without assembly name specified" ) ]
217+ #endif
214218 public void Can_deserialise_polymorphic_list_serialized_by_datacontractjsonserializer ( )
215219 {
216220 Func < string , Type > typeFinder = value => {
@@ -223,9 +227,14 @@ public void Can_deserialise_polymorphic_list_serialized_by_datacontractjsonseria
223227 try {
224228 var originalList = new List < Animal > { new Dog { Name = "Fido" } , new Cat { Name = "Tigger" } } ;
225229#if NETCORE
226- var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( List < Animal > ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } ) ;
230+ var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( List < Animal > ) ,
231+ new DataContractJsonSerializerSettings ( ) {
232+ KnownTypes = new [ ] { typeof ( Dog ) , typeof ( Cat ) } ,
233+ MaxItemsInObjectGraph = int . MaxValue ,
234+ EmitTypeInformation = EmitTypeInformation . Always
235+ } ) ;
227236#else
228- var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( List < Animal > ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } , int . MaxValue , true , null , true ) ;
237+ var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( List < Animal > ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } , int . MaxValue , true , null , true ) ;
229238#endif
230239 JsConfig . TypeFinder = typeFinder ;
231240 List < Animal > deserializedList = null ;
@@ -308,6 +317,9 @@ public void Can_deserialise_an_entity_containing_a_polymorphic_list()
308317
309318#if ! IOS
310319 [ Test ]
320+ #if NETCORE
321+ [ Ignore ( ".NET Core does not allow to find types without assembly name specified" ) ]
322+ #endif
311323 public void Can_deserialise_an_entity_containing_a_polymorphic_property_serialized_by_datacontractjsonserializer ( )
312324 {
313325 Func < string , Type > typeFinder = value => {
@@ -321,9 +333,14 @@ public void Can_deserialise_an_entity_containing_a_polymorphic_property_serializ
321333 var originalPets = new Pets { Cat = new Cat { Name = "Tigger" } , Dog = new Dog { Name = "Fido" } } ;
322334
323335#if NETCORE
324- var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( Pets ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } ) ;
336+ var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( Pets ) ,
337+ new DataContractJsonSerializerSettings ( ) {
338+ KnownTypes = new [ ] { typeof ( Dog ) , typeof ( Cat ) } ,
339+ MaxItemsInObjectGraph = int . MaxValue ,
340+ EmitTypeInformation = EmitTypeInformation . Always
341+ } ) ;
325342#else
326- var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( Pets ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } , int . MaxValue , true , null , true ) ;
343+ var dataContractJsonSerializer = new DataContractJsonSerializer ( typeof ( Pets ) , new [ ] { typeof ( Dog ) , typeof ( Cat ) } , int . MaxValue , true , null , true ) ;
327344#endif
328345 JsConfig . TypeFinder = typeFinder ;
329346 Pets deserializedPets = null ;
0 commit comments