@@ -71,9 +71,7 @@ public void Can_Deserialize_Select_Tokens()
71
71
public void Can_Deserialize_4sq_Json_With_Root_Element_Specified ( )
72
72
{
73
73
var doc = File . ReadAllText ( Path . Combine ( "SampleData" , "4sq.txt" ) ) ;
74
- var json = new JsonDeserializer ( ) ;
75
-
76
- json . RootElement = "response" ;
74
+ var json = new JsonDeserializer { RootElement = "response" } ;
77
75
78
76
var output = json . Deserialize < VenuesResponse > ( new RestResponse { Content = doc } ) ;
79
77
@@ -137,9 +135,7 @@ public void Can_Deserialize_Simple_Generic_List_Given_Toplevel_Item_Without_Arra
137
135
public void Can_Deserialize_From_Root_Element ( )
138
136
{
139
137
var doc = File . ReadAllText ( Path . Combine ( "SampleData" , "sojson.txt" ) ) ;
140
- var json = new JsonDeserializer ( ) ;
141
-
142
- json . RootElement = "User" ;
138
+ var json = new JsonDeserializer { RootElement = "User" } ;
143
139
144
140
var output = json . Deserialize < SOUser > ( new RestResponse { Content = doc } ) ;
145
141
@@ -151,7 +147,7 @@ public void Can_Deserialize_To_Dictionary_String_Object()
151
147
{
152
148
var doc = File . ReadAllText ( Path . Combine ( "SampleData" , "jsondictionary.txt" ) ) ;
153
149
var json = new JsonDeserializer ( ) ;
154
- var output = json . Deserialize < Dictionary < string , object > > ( new RestResponse ( ) { Content = doc } ) ;
150
+ var output = json . Deserialize < Dictionary < string , object > > ( new RestResponse { Content = doc } ) ;
155
151
156
152
Assert . Equal ( output . Keys . Count , 3 ) ;
157
153
@@ -177,7 +173,7 @@ public void Can_Deserialize_List_of_Guid()
177
173
Guid ID2 = new Guid ( "809399fa-21c4-4dca-8dcd-34cb697fbca0" ) ;
178
174
var data = new JsonObject ( ) ;
179
175
180
- data [ "Ids" ] = new JsonArray ( ) { ID1 , ID2 } ;
176
+ data [ "Ids" ] = new JsonArray { ID1 , ID2 } ;
181
177
182
178
var d = new JsonDeserializer ( ) ;
183
179
var response = new RestResponse { Content = data . ToString ( ) } ;
@@ -264,7 +260,7 @@ public void Can_Deserialize_Json_Using_DeserializeAs_Attribute()
264
260
public void Can_Deserialize_Custom_Formatted_Date ( )
265
261
{
266
262
var culture = CultureInfo . InvariantCulture ;
267
- var format = "dd yyyy MMM, hh:mm ss tt" ;
263
+ const string format = "dd yyyy MMM, hh:mm ss tt" ;
268
264
var date = new DateTime ( 2010 , 2 , 8 , 11 , 11 , 11 ) ;
269
265
var formatted = new { StartDate = date . ToString ( format , culture ) } ;
270
266
var data = SimpleJson . SerializeObject ( formatted ) ;
@@ -430,9 +426,7 @@ public void Can_Deserialize_Names_With_Underscore_Prefix()
430
426
{
431
427
var data = File . ReadAllText ( Path . Combine ( "SampleData" , "underscore_prefix.txt" ) ) ;
432
428
var response = new RestResponse { Content = data } ;
433
- var json = new JsonDeserializer ( ) ;
434
-
435
- json . RootElement = "User" ;
429
+ var json = new JsonDeserializer { RootElement = "User" } ;
436
430
437
431
var output = json . Deserialize < SOUser > ( response ) ;
438
432
@@ -699,7 +693,7 @@ public void Can_Deserialize_To_Dictionary_String_String_With_Dynamic_Values()
699
693
public void Can_Deserialize_Decimal_With_Four_Zeros_After_Floating_Point ( )
700
694
{
701
695
const string json = "{\" Value\" :0.00005557}" ;
702
- var response = new RestResponse ( ) { Content = json } ;
696
+ var response = new RestResponse { Content = json } ;
703
697
var d = new JsonDeserializer ( ) ;
704
698
var result = d . Deserialize < DecimalNumber > ( response ) ;
705
699
@@ -718,9 +712,7 @@ public void Can_Deserialize_Object_Type_Property_With_Primitive_Vale()
718
712
public void Can_Deserialize_Dictionary_of_Lists ( )
719
713
{
720
714
var doc = File . ReadAllText ( Path . Combine ( "SampleData" , "jsondictionary.txt" ) ) ;
721
- var json = new JsonDeserializer ( ) ;
722
-
723
- json . RootElement = "response" ;
715
+ var json = new JsonDeserializer { RootElement = "response" } ;
724
716
725
717
var output = json . Deserialize < EmployeeTracker > ( new RestResponse { Content = doc } ) ;
726
718
@@ -820,9 +812,10 @@ private string CreateJsonWithDashes()
820
812
821
813
private string CreateIsoDateJson ( )
822
814
{
823
- var bd = new Birthdate ( ) ;
824
-
825
- bd . Value = new DateTime ( 1910 , 9 , 25 , 9 , 30 , 25 , DateTimeKind . Utc ) ;
815
+ var bd = new Birthdate
816
+ {
817
+ Value = new DateTime ( 1910 , 9 , 25 , 9 , 30 , 25 , DateTimeKind . Utc )
818
+ } ;
826
819
827
820
return SimpleJson . SerializeObject ( bd ) ;
828
821
}
0 commit comments