1+ using System ;
2+ using System . Collections . Generic ;
3+ using NUnit . Framework ;
4+
5+ namespace ServiceStack . Text . Tests . JsonTests
6+ {
7+ public class TypeInfoTests
8+ {
9+ class MyClass : IComparable
10+ {
11+ public int CompareTo ( object obj )
12+ {
13+ return 0 ;
14+ }
15+ }
16+
17+ [ Test ]
18+ [ TestCase ( "[{'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
19+ [ TestCase ( "[{ '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
20+ [ TestCase ( "[{\n '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
21+ [ TestCase ( "[{\t '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
22+ [ TestCase ( "[ {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
23+ [ TestCase ( "[\n {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
24+ [ TestCase ( "[\t {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
25+ [ TestCase ( "[ { '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
26+ [ TestCase ( "[\n {\n '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
27+ [ TestCase ( "[\t {\t '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
28+ [ TestCase ( "[{'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'} ]" ) ]
29+ [ TestCase ( "[{ '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}\t ]" ) ]
30+ [ TestCase ( "[{\n '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}\n ]" ) ]
31+ [ TestCase ( "[{\t '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass' }]" ) ]
32+ [ TestCase ( "[ {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'\t }]" ) ]
33+ [ TestCase ( "[\n {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'\n }]" ) ]
34+ [ TestCase ( "[\t {'__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'\t }\n ]" ) ]
35+ [ TestCase ( "[ { '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass', }]" ) ]
36+ [ TestCase ( "[\n {\n '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
37+ [ TestCase ( "[\t {\t '__type':'ServiceStack.Text.Tests.JsonTests.TypeInfoTests+MyClass'}]" ) ]
38+ public void TypeAttrInObject ( string json )
39+ {
40+ json = json . Replace ( '\' ' , '"' ) ;
41+ var deserDto = JsonSerializer . DeserializeFromString < List < IComparable > > ( json ) ;
42+ Console . WriteLine ( json ) ;
43+ Assert . IsNotNull ( deserDto ) ;
44+ Assert . AreEqual ( 1 , deserDto . Count ) ;
45+ Assert . IsNotNull ( deserDto [ 0 ] ) ;
46+ }
47+
48+ }
49+ }
0 commit comments