File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -122,14 +122,27 @@ public void Can_serialize_and_deserialize_arrays_of_class_objects()
122122 [ TestMethod ]
123123 public void Can_deserialize_string_starting_with_unicode_escape ( )
124124 {
125- // escaped JSON: "Product":"\u00315 litres" -> Product = "5 liters"
126- var json = "{\" Product\" :\" \\ u00315 litres\" ,\" Count\" :10}" ;
127125
128- var item = JsonConvert . DeserializeObject ( json , typeof ( Item ) ) as Item ;
126+ OutputHelper . WriteLine ( "Starting test..." ) ;
127+
128+ Console . WriteLine ( $ "{ TimeSpan . FromHours ( 1 ) . TotalMilliseconds } ") ;
129+
130+ JsonTestCompany test = new JsonTestCompany
131+ {
132+ CompanyID = 10 ,
133+ CompanyName = "5 Guys"
134+ } ;
135+ // escaped JSON: "CompanyName":"\u00315 Guys" -> CompanyName = "5 Guys"
136+ var jsonString = "{\u0022 CompanyID\u0022 :10,\u0022 CompanyName\u0022 :\u0022 5 Guys\u0022 }" ;
137+
138+
139+ JsonTestCompany deserializedResult = ( JsonTestCompany ) JsonConvert . DeserializeObject ( jsonString , typeof ( JsonTestCompany ) ) ;
129140
130- Assert . NotNull ( item ) ;
131- Assert . Equal ( "5 liters" , item . Product ) ;
132- Assert . Equal ( 10 , item . Count ) ;
141+ Assert . NotNull ( deserializedResult ) ;
142+ Assert . Equal ( "5 Guys" , deserializedResult . CompanyName ) ;
143+ Assert . Equal ( 10 , deserializedResult . CompanyID ) ;
144+
145+ OutputHelper . WriteLine ( "Finished test..." ) ;
133146 }
134147
135148 [ TestMethod ]
You can’t perform that action at this time.
0 commit comments