1
1
using DendroDocs . Json ;
2
- using Newtonsoft . Json ;
2
+ using System . Text . Json ;
3
3
4
4
namespace DendroDocs . Tool . Tests ;
5
5
@@ -13,7 +13,7 @@ public void NoTypes_Should_GiveEmptyArray()
13
13
var json = @"[]" ;
14
14
15
15
// Act
16
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
16
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
17
17
18
18
// Assert
19
19
types . Should ( ) . BeEmpty ( ) ;
@@ -26,7 +26,7 @@ public void AClassWithoutAModifierShouldBeInternalByDefault()
26
26
var json = @"[{""FullName"":""Test""}]" ;
27
27
28
28
// Act
29
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
29
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
30
30
31
31
// Assert
32
32
types . Should ( ) . HaveCount ( 1 ) ;
@@ -43,7 +43,7 @@ public void Collections_Should_NotBeNull()
43
43
var json = @"[{""FullName"":""Test""}]" ;
44
44
45
45
// Act
46
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
46
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
47
47
48
48
// Assert
49
49
types [ 0 ] . Fields . Should ( ) . BeEmpty ( ) ;
@@ -78,7 +78,7 @@ public void ModifiersShouldBeDeserializedCorrectly(int value, Modifier modifier)
78
78
var json = @$ "[{{""Modifiers"":{ value } ,""FullName"":""Test""}}]";
79
79
80
80
// Act
81
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
81
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
82
82
83
83
// Assert
84
84
types [ 0 ] . Modifiers . Should ( ) . Be ( modifier ) ;
@@ -91,7 +91,7 @@ public void MembersOfAClassWithoutAModifierShouldBePrivateByDefault()
91
91
var json = @"[{""FullName"":""Test"",""Methods"":[{""Name"":""Method""}]}]" ;
92
92
93
93
// Act
94
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
94
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
95
95
96
96
// Assert
97
97
types [ 0 ] . Methods . Should ( ) . HaveCount ( 1 ) ;
@@ -107,7 +107,7 @@ public void AttributeCollection_Should_GiveAttributeWithNameAndType()
107
107
var json = @"[{""FullName"":""Test"",""Attributes"":[{""Type"":""System.ObsoleteAttribute"",""Name"":""System.Obsolete""}]}]" ;
108
108
109
109
// Act
110
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
110
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
111
111
112
112
// Assert
113
113
types [ 0 ] . Attributes . Should ( ) . HaveCount ( 1 ) ;
@@ -123,7 +123,7 @@ public void AttributeArgumentCollection_Should_GiveAttributeArgumentWithName_Typ
123
123
var json = @"[{""FullName"":""Test"",""Attributes"":[{""Type"":""System.ObsoleteAttribute"",""Name"":""System.Obsolete"",""Arguments"":[{""Name"":""\""Reason\"""",""Type"":""string"",""Value"":""Reason""}]}]}]" ;
124
124
125
125
// Act
126
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
126
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
127
127
128
128
// Assert
129
129
types [ 0 ] . Attributes [ 0 ] . Arguments . Should ( ) . HaveCount ( 1 ) ;
@@ -150,7 +150,7 @@ public void AStatementInAMethodBodyShouldHaveTheMethodAsParent()
150
150
}]" ;
151
151
152
152
// Act
153
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
153
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
154
154
155
155
// Assert
156
156
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Parent . Should ( ) . Be ( types [ 0 ] . Methods [ 0 ] ) ;
@@ -173,7 +173,7 @@ public void AStatementInAConstructorBodyShouldHaveTheConstructorAsParent()
173
173
}]" ;
174
174
175
175
// Act
176
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
176
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
177
177
178
178
// Assert
179
179
types [ 0 ] . Constructors [ 0 ] . Statements [ 0 ] . Parent . Should ( ) . Be ( types [ 0 ] . Constructors [ 0 ] ) ;
@@ -195,7 +195,7 @@ public void AnIfElseSectionShouldHaveTheIfAsParent()
195
195
}]" ;
196
196
197
197
// Act
198
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
198
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
199
199
200
200
// Assert
201
201
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < If > ( ) ;
@@ -220,7 +220,7 @@ public void AnIfElseConditionShouldBeParsedCorrectly()
220
220
}]" ;
221
221
222
222
// Act
223
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
223
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
224
224
225
225
// Assert
226
226
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < If > ( ) ;
@@ -251,7 +251,7 @@ public void AStatementInAnIfElseSectionShouldHaveTheIfElseSectionAsParent()
251
251
}]" ;
252
252
253
253
// Act
254
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
254
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
255
255
256
256
// Assert
257
257
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < If > ( ) ;
@@ -276,7 +276,7 @@ public void ASwitchSectionShouldHaveTheSwitchAsParent()
276
276
}]" ;
277
277
278
278
// Act
279
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
279
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
280
280
281
281
// Assert
282
282
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < Switch > ( ) ;
@@ -301,7 +301,7 @@ public void ASwitchExpressionShouldBeParsedCorrectly()
301
301
}]" ;
302
302
303
303
// Act
304
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
304
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
305
305
306
306
// Assert
307
307
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < Switch > ( ) ;
@@ -328,7 +328,7 @@ public void SwitchLabelsShouldBeParsedCorrectly()
328
328
}]" ;
329
329
330
330
// Act
331
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
331
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
332
332
333
333
// Assert
334
334
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < Switch > ( ) ;
@@ -360,7 +360,7 @@ public void AStatementInASwitchSectionShouldHaveTheSwitchSectionAsParent()
360
360
}]" ;
361
361
362
362
// Act
363
- var types = JsonConvert . DeserializeObject < List < TypeDescription > > ( json , JsonDefaults . DeserializerSettings ( ) ) ;
363
+ var types = JsonSerializer . Deserialize < List < TypeDescription > > ( json , JsonDefaults . DeserializerOptions ( ) ) ! ;
364
364
365
365
// Assert
366
366
types [ 0 ] . Methods [ 0 ] . Statements [ 0 ] . Should ( ) . BeOfType < Switch > ( ) ;
0 commit comments