88using Contentstack . Management . Core . Tests . Helpers ;
99using Microsoft . VisualStudio . TestTools . UnitTesting ;
1010using Contentstack . Management . Core . Queryable ;
11- using Newtonsoft . Json . Linq ;
11+ using System . Text . Json ;
1212
1313namespace Contentstack . Management . Core . Tests . IntegrationTest
1414{
@@ -145,7 +145,7 @@ public void Test005_Should_Return_Loggedin_User()
145145
146146 ContentstackResponse response = client . GetUser ( ) ;
147147
148- var user = response . OpenJObjectResponse ( ) ;
148+ var user = response . OpenJsonObjectResponse ( ) ;
149149
150150 AssertLogger . IsNotNull ( user , "user" ) ;
151151
@@ -169,11 +169,11 @@ public async System.Threading.Tasks.Task Test006_Should_Return_Loggedin_User_Asy
169169
170170 ContentstackResponse response = await client . GetUserAsync ( ) ;
171171
172- var user = response . OpenJObjectResponse ( ) ;
172+ var user = response . OpenJsonObjectResponse ( ) ;
173173
174174 AssertLogger . IsNotNull ( user , "user" ) ;
175175 AssertLogger . IsNotNull ( user [ "user" ] [ "organizations" ] , "organizations" ) ;
176- AssertLogger . IsInstanceOfType ( user [ "user" ] [ "organizations" ] , typeof ( JArray ) , "organizations" ) ;
176+ AssertLogger . IsInstanceOfType ( user [ "user" ] [ "organizations" ] , typeof ( System . Text . Json . Nodes . JsonArray ) , "organizations" ) ;
177177 AssertLogger . IsNull ( user [ "user" ] [ "organizations" ] [ 0 ] [ "org_roles" ] , "org_roles" ) ;
178178
179179 }
@@ -199,11 +199,11 @@ public void Test007_Should_Return_Loggedin_User_With_Organizations_detail()
199199
200200 ContentstackResponse response = client . GetUser ( collection ) ;
201201
202- var user = response . OpenJObjectResponse ( ) ;
202+ var user = response . OpenJsonObjectResponse ( ) ;
203203
204204 AssertLogger . IsNotNull ( user , "user" ) ;
205205 AssertLogger . IsNotNull ( user [ "user" ] [ "organizations" ] , "organizations" ) ;
206- AssertLogger . IsInstanceOfType ( user [ "user" ] [ "organizations" ] , typeof ( JArray ) , "organizations" ) ;
206+ AssertLogger . IsInstanceOfType ( user [ "user" ] [ "organizations" ] , typeof ( System . Text . Json . Nodes . JsonArray ) , "organizations" ) ;
207207 AssertLogger . IsNotNull ( user [ "user" ] [ "organizations" ] [ 0 ] [ "org_roles" ] , "org_roles" ) ;
208208 }
209209 catch ( Exception e )
@@ -1000,7 +1000,7 @@ public void Test056_Should_Handle_Malformed_JSON_Response_Sync()
10001000 {
10011001 AssertLogger . IsTrue ( true , "ContentstackErrorException acceptable for malformed JSON" ) ;
10021002 }
1003- catch ( Newtonsoft . Json . JsonException )
1003+ catch ( System . Text . Json . JsonException )
10041004 {
10051005 AssertLogger . IsTrue ( true , "JsonException acceptable for malformed JSON" ) ;
10061006 }
@@ -1027,7 +1027,7 @@ public async System.Threading.Tasks.Task Test057_Should_Handle_Malformed_JSON_Re
10271027 {
10281028 AssertLogger . IsTrue ( true , "ContentstackErrorException acceptable for malformed JSON" ) ;
10291029 }
1030- catch ( Newtonsoft . Json . JsonException )
1030+ catch ( System . Text . Json . JsonException )
10311031 {
10321032 AssertLogger . IsTrue ( true , "JsonException acceptable for malformed JSON" ) ;
10331033 }
@@ -1058,7 +1058,7 @@ public void Test058_Should_Handle_Empty_Response_Body_Sync()
10581058 {
10591059 AssertLogger . IsTrue ( true , "ArgumentException acceptable for empty response" ) ;
10601060 }
1061- catch ( Newtonsoft . Json . JsonReaderException )
1061+ catch ( System . Text . Json . JsonException )
10621062 {
10631063 AssertLogger . IsTrue ( true , "JsonReaderException acceptable for empty response" ) ;
10641064 }
@@ -1089,7 +1089,7 @@ public async System.Threading.Tasks.Task Test059_Should_Handle_Empty_Response_Bo
10891089 {
10901090 AssertLogger . IsTrue ( true , "ArgumentException acceptable for empty response" ) ;
10911091 }
1092- catch ( Newtonsoft . Json . JsonReaderException )
1092+ catch ( System . Text . Json . JsonException )
10931093 {
10941094 AssertLogger . IsTrue ( true , "JsonReaderException acceptable for empty response" ) ;
10951095 }
@@ -1141,7 +1141,7 @@ public void Test060_Should_Handle_Unexpected_Response_Structure_Sync()
11411141 {
11421142 AssertLogger . IsTrue ( true , "KeyNotFoundException acceptable for unexpected structure" ) ;
11431143 }
1144- catch ( Newtonsoft . Json . JsonException )
1144+ catch ( System . Text . Json . JsonException )
11451145 {
11461146 AssertLogger . IsTrue ( true , "JsonException acceptable for unexpected structure" ) ;
11471147 }
@@ -1284,8 +1284,9 @@ public void Test069_Should_Handle_GetUser_With_Extremely_Large_Parameters_Sync()
12841284 catch ( ContentstackErrorException errorException )
12851285 {
12861286 AssertLogger . IsTrue ( errorException . StatusCode == HttpStatusCode . BadRequest ||
1287- errorException . StatusCode == HttpStatusCode . RequestEntityTooLarge ,
1288- "Expected 400 or 413 for large parameters" ) ;
1287+ errorException . StatusCode == HttpStatusCode . RequestEntityTooLarge ||
1288+ errorException . StatusCode == HttpStatusCode . RequestUriTooLong ,
1289+ "Expected 400, 413, or 414 for large parameters" ) ;
12891290 }
12901291 catch ( Exception e )
12911292 {
@@ -1393,7 +1394,7 @@ public void Test073_Should_Handle_GetUser_Malformed_Response_Sync()
13931394 {
13941395 AssertLogger . IsTrue ( true , "ContentstackErrorException acceptable for malformed response" ) ;
13951396 }
1396- catch ( Newtonsoft . Json . JsonException )
1397+ catch ( System . Text . Json . JsonException )
13971398 {
13981399 AssertLogger . IsTrue ( true , "JsonException acceptable for malformed response" ) ;
13991400 }
@@ -1856,7 +1857,7 @@ public async System.Threading.Tasks.Task Test100_Should_Validate_Complete_Error_
18561857 {
18571858 results . Add ( ( scenario , false , "TaskCanceledException" ) ) ;
18581859 }
1859- catch ( Newtonsoft . Json . JsonException )
1860+ catch ( System . Text . Json . JsonException )
18601861 {
18611862 results . Add ( ( scenario , false , "JsonException" ) ) ;
18621863 }
0 commit comments