Skip to content

Commit 23c5277

Browse files
Merge pull request #169 from contentstack/feat/dx-4964
Moved newtonsoft json to system text json
2 parents 47970b2 + e07f21b commit 23c5277

79 files changed

Lines changed: 840 additions & 549 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/sca-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup .NET Core @ Latest
1414
uses: actions/setup-dotnet@v1
1515
with:
16-
dotnet-version: "7.0.x"
16+
dotnet-version: "10.0.x"
1717

1818
- name: Run Dotnet Restore
1919
run: dotnet restore

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
steps:
1010
- name: Checkout repository
1111
uses: actions/checkout@v4.2.2
12-
- name: Setup .NET 7.0
12+
- name: Setup .NET
1313
uses: actions/setup-dotnet@v4.3.0
1414
with:
15-
dotnet-version: '7.0.x'
15+
dotnet-version: '10.0.x'
1616
- name: Restore dependencies
1717
run: dotnet restore Contentstack.Net.sln
1818
- name: Build solution

Contentstack.Core.Tests/Contentstack.Core.Tests.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
<ReleaseVersion>$(Version)</ReleaseVersion>
@@ -27,17 +27,9 @@
2727
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.2.10" />
2828
<PackageReference Include="AutoFixture" Version="4.18.1" />
2929
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
30-
<PackageReference Include="System.Net.Http" Version="4.3.4" />
31-
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
3230
<PackageReference Include="Moq" Version="4.20.72" />
33-
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
3431
</ItemGroup>
3532

36-
<ItemGroup>
37-
<Reference Include="Contentstack.Core">
38-
<HintPath>..\Contentstack.Core\bin\Debug\Contentstack.Core.dll</HintPath>
39-
</Reference>
40-
</ItemGroup>
4133
<ItemGroup>
4234
<Compile Remove="SingletoneTest.cs" />
4335
<Compile Remove="EmptyClass.cs" />

Contentstack.Core.Tests/Helpers/EntryFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public async Task<ContentstackCollection<Entry>> FetchFirstEntryAsync(string con
228228
/// </summary>
229229
/// <param name="contentTypeUid">Content type UID</param>
230230
/// <returns>Count result</returns>
231-
public async Task<Newtonsoft.Json.Linq.JObject> CountEntriesAsync(string contentTypeUid)
231+
public async Task<System.Text.Json.Nodes.JsonObject> CountEntriesAsync(string contentTypeUid)
232232
{
233233
return await CreateQuery(contentTypeUid).Count();
234234
}

Contentstack.Core.Tests/Integration/AssetTests/AssetManagementComprehensiveTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public async Task Asset_Tags_Available()
560560

561561
#region Helper Methods
562562

563-
private ContentstackClient CreateClient()
563+
private new ContentstackClient CreateClient()
564564
{
565565
var options = new ContentstackOptions()
566566
{

Contentstack.Core.Tests/Integration/BranchTests/MetadataBranchComprehensiveTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public async Task Metadata_Performance_WithOwner()
382382

383383
#region Helper Methods
384384

385-
private ContentstackClient CreateClient()
385+
private new ContentstackClient CreateClient()
386386
{
387387
var options = new ContentstackOptions()
388388
{

Contentstack.Core.Tests/Integration/CachingTests/CachePersistenceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public async Task Cache_DifferentProjections_IndependentCache()
439439

440440
#region Helper Methods
441441

442-
private ContentstackClient CreateClient()
442+
private new ContentstackClient CreateClient()
443443
{
444444
var options = new ContentstackOptions()
445445
{

Contentstack.Core.Tests/Integration/ClientTests/ContentstackClientTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public ContentstackClientTest(ITestOutputHelper output) : base(output)
1717
{
1818
}
1919

20-
private ContentstackClient CreateClient()
20+
private new ContentstackClient CreateClient()
2121
{
2222
var options = new ContentstackOptions()
2323
{

Contentstack.Core.Tests/Integration/ContentTypeTests/ContentTypeOperationsTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Contentstack.Core.Configuration;
77
using Contentstack.Core.Models;
88
using Contentstack.Core.Tests.Helpers;
9-
using Newtonsoft.Json.Linq;
9+
using System.Text.Json.Nodes;
1010
using System.Collections;
1111
using Xunit.Abstractions;
1212

@@ -165,10 +165,10 @@ public async Task ContentType_FetchSingleContentType_ReturnsSchema()
165165
LogAssert("Verifying response");
166166

167167
TestAssert.NotNull(schema);
168-
TestAssert.IsType<JObject>(schema);
168+
TestAssert.IsType<JsonObject>(schema);
169169
// Schema should contain uid
170170
TestAssert.True(schema.ContainsKey("uid"));
171-
TestAssert.Equal(TestDataHelper.SimpleContentTypeUid, schema["uid"]?.ToString());
171+
TestAssert.Equal(TestDataHelper.SimpleContentTypeUid, schema["uid"]?.GetValue<string>());
172172
}
173173

174174
[Fact(DisplayName = "Content Type - Content Type Fetch With Global Fields Includes Global Field Schema")]
@@ -194,7 +194,7 @@ public async Task ContentType_FetchWithGlobalFields_IncludesGlobalFieldSchema()
194194
LogAssert("Verifying response");
195195

196196
TestAssert.NotNull(schema);
197-
TestAssert.IsType<JObject>(schema);
197+
TestAssert.IsType<JsonObject>(schema);
198198
}
199199

200200
[Fact(DisplayName = "Content Type - Content Type Fetch Complex Type Contains Expected Fields")]
@@ -216,7 +216,7 @@ public async Task ContentType_FetchComplexType_ContainsExpectedFields()
216216
LogAssert("Verifying response");
217217

218218
TestAssert.NotNull(schema);
219-
TestAssert.IsType<JObject>(schema);
219+
TestAssert.IsType<JsonObject>(schema);
220220
// Should have schema field
221221
TestAssert.True(schema.ContainsKey("schema"));
222222
}
@@ -287,7 +287,7 @@ public async Task ContentType_Schema_ContainsUid()
287287

288288
TestAssert.NotNull(schema);
289289
TestAssert.True(schema.ContainsKey("uid"));
290-
TestAssert.Equal(TestDataHelper.MediumContentTypeUid, schema["uid"].ToString());
290+
TestAssert.Equal(TestDataHelper.MediumContentTypeUid, schema["uid"]?.GetValue<string>());
291291
}
292292

293293
[Fact(DisplayName = "Content Type - Content Type Schema Contains Schema Definition")]
@@ -310,7 +310,7 @@ public async Task ContentType_Schema_ContainsSchemaDefinition()
310310

311311
TestAssert.NotNull(schema);
312312
TestAssert.True(schema.ContainsKey("schema"));
313-
var schemaArray = schema["schema"] as JArray;
313+
var schemaArray = schema["schema"] as JsonArray;
314314
TestAssert.NotNull(schemaArray);
315315
TestAssert.True(schemaArray.Count > 0, "Schema should contain field definitions");
316316
}
@@ -402,7 +402,7 @@ public async Task ContentType_MultipleContentTypes_AllFetchSuccessfully()
402402

403403
#region Helper Methods
404404

405-
private ContentstackClient CreateClient()
405+
private new ContentstackClient CreateClient()
406406
{
407407
var options = new ContentstackOptions()
408408
{

Contentstack.Core.Tests/Integration/ContentTypeTests/ContentTypeQueryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Contentstack.Core.Configuration;
77
using Contentstack.Core.Models;
88
using Contentstack.Core.Tests.Helpers;
9-
using Newtonsoft.Json.Linq;
9+
using System.Text.Json.Nodes;
1010
using Xunit.Abstractions;
1111

1212
namespace Contentstack.Core.Tests.Integration.ContentTypeTests
@@ -117,7 +117,7 @@ public async Task ContentTypeQuery_SchemaValidation_IsValidJObject()
117117
LogAssert("Verifying response");
118118

119119
TestAssert.NotNull(schema);
120-
TestAssert.IsType<JObject>(schema);
120+
TestAssert.IsType<JsonObject>(schema);
121121
}
122122

123123
#endregion
@@ -360,7 +360,7 @@ await TestAssert.ThrowsAnyAsync<Exception>(async () =>
360360

361361
#region Helper Methods
362362

363-
private ContentstackClient CreateClient()
363+
private new ContentstackClient CreateClient()
364364
{
365365
var options = new ContentstackOptions()
366366
{

0 commit comments

Comments
 (0)