Skip to content

Commit e105f7a

Browse files
Merge pull request #142 from contentstack/staging
DX | 10-11-2025 | Release
2 parents 811b6ea + 97cb4ef commit e105f7a

File tree

65 files changed

+16039
-657
lines changed

Some content is hidden

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

65 files changed

+16039
-657
lines changed

.github/workflows/unit-test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Unit Test
2+
on:
3+
pull_request:
4+
push:
5+
6+
jobs:
7+
unit-test:
8+
runs-on: windows-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4.2.2
12+
- name: Setup .NET 7.0
13+
uses: actions/setup-dotnet@v4.3.0
14+
with:
15+
dotnet-version: '7.0.x'
16+
- name: Restore dependencies
17+
run: dotnet restore Contentstack.Net.sln
18+
- name: Build solution
19+
run: dotnet build Contentstack.Net.sln --no-restore --configuration Debug
20+
- name: Run unit tests
21+
run: dotnet test Contentstack.Core.Unit.Tests/Contentstack.Core.Unit.Tests.csproj --no-build --verbosity normal --configuration Debug
22+

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version: 2.25.1
2+
#### Date: Nov-10-2025
3+
4+
##### Enh:
5+
- Improved Error messages
6+
17
### Version: 2.25.0
28
#### Date: Jan-07-2025
39

Contentstack.Core.Tests/AssetTest.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ await asset.Fetch().ContinueWith((t) =>
3131
Asset result = t.Result;
3232
if (result == null)
3333
{
34-
Assert.False(true, "Entry.Fetch is not match with expected result.");
34+
Assert.Fail( "Entry.Fetch is not match with expected result.");
3535
}
3636
else
3737
{
@@ -116,7 +116,7 @@ public async Task FetchAssetsOrderByAscending()
116116
{
117117
if (dateTime.CompareTo(asset.GetCreateAt()) != -1 && dateTime.CompareTo(asset.GetCreateAt()) != 0)
118118
{
119-
Assert.False(true);
119+
Assert.Fail();
120120
}
121121
}
122122
dateTime = asset.GetCreateAt();
@@ -162,15 +162,15 @@ public async Task FetchAssetCountAsync()
162162
JObject jObject = await assetLibrary.Count();
163163
if (jObject == null)
164164
{
165-
Assert.False(true, "Query.Exec is not match with expected result.");
165+
Assert.Fail( "Query.Exec is not match with expected result.");
166166
}
167167
else if (jObject != null)
168168
{
169169
Assert.Equal(5, jObject.GetValue("assets"));
170170
}
171171
else
172172
{
173-
Assert.False(true, "Result doesn't mathced the count.");
173+
Assert.Fail( "Result doesn't mathced the count.");
174174
}
175175
}
176176

@@ -181,15 +181,15 @@ public async Task FetchAssetSkipLimit()
181181
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
182182
if (assets == null)
183183
{
184-
Assert.False(true, "Query.Exec is not match with expected result.");
184+
Assert.Fail( "Query.Exec is not match with expected result.");
185185
}
186186
else if (assets != null)
187187
{
188188
Assert.Equal(3, assets.Items.Count());
189189
}
190190
else
191191
{
192-
Assert.False(true, "Result doesn't mathced the count.");
192+
Assert.Fail( "Result doesn't mathced the count.");
193193
}
194194
}
195195

@@ -200,7 +200,7 @@ public async Task FetchAssetOnly()
200200
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
201201
if (assets == null)
202202
{
203-
Assert.False(true, "Query.Exec is not match with expected result.");
203+
Assert.Fail( "Query.Exec is not match with expected result.");
204204
}
205205
else if (assets != null)
206206
{
@@ -215,7 +215,7 @@ public async Task FetchAssetOnly()
215215
}
216216
else
217217
{
218-
Assert.False(true, "Result doesn't mathced the count.");
218+
Assert.Fail( "Result doesn't mathced the count.");
219219
}
220220
}
221221

@@ -226,7 +226,7 @@ public async Task FetchAssetExcept()
226226
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
227227
if (assets == null)
228228
{
229-
Assert.False(true, "Query.Exec is not match with expected result.");
229+
Assert.Fail( "Query.Exec is not match with expected result.");
230230
}
231231
else if (assets != null)
232232
{
@@ -238,7 +238,7 @@ public async Task FetchAssetExcept()
238238
}
239239
else
240240
{
241-
Assert.False(true, "Result doesn't mathced the count.");
241+
Assert.Fail( "Result doesn't mathced the count.");
242242
}
243243
}
244244
[Fact]

Contentstack.Core.Tests/ContentTypeTest.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Xunit;
33
using Contentstack.Core.Models;
4+
using Contentstack.Core.Internals;
45
using System.Threading.Tasks;
56
using System.Collections.Generic;
67
using Newtonsoft.Json.Linq;
@@ -21,7 +22,7 @@ public async Task FetchContenTypeSchema()
2122
var result = await contenttype.Fetch();
2223
if (result == null)
2324
{
24-
Assert.False(true, "contenttype.FetchSchema() is not match with expected result.");
25+
Assert.Fail( "contenttype.FetchSchema() is not match with expected result.");
2526
}
2627
else
2728
{
@@ -38,7 +39,7 @@ public async Task FetchContenTypeSchemaIncludeGlobalFields()
3839
var result = await contenttype.Fetch(param);
3940
if (result == null)
4041
{
41-
Assert.False(true, "contenttype.FetchSchema() is not match with expected result.");
42+
Assert.Fail( "contenttype.FetchSchema() is not match with expected result.");
4243
}
4344
else
4445
{
@@ -53,7 +54,7 @@ public async Task GetContentTypes()
5354

5455
if (result == null)
5556
{
56-
Assert.False(true, "client.getContentTypes is not match with expected result.");
57+
Assert.Fail( "client.getContentTypes is not match with expected result.");
5758
}
5859
else
5960
{
@@ -72,7 +73,7 @@ public async Task GetContentTypesIncludeGlobalFields()
7273

7374
if (result == null)
7475
{
75-
Assert.False(true, "client.getContentTypes is not match with expected result.");
76+
Assert.Fail( "client.getContentTypes is not match with expected result.");
7677
}
7778
else
7879
{
@@ -143,7 +144,7 @@ public async Task FetchGlobalFieldSchema_NullParameters_Succeeds()
143144
[Fact]
144145
public void GlobalField_EmptyUid_Throws()
145146
{
146-
Assert.Throws<ArgumentNullException>(() => {
147+
Assert.Throws<GlobalFieldException>(() => {
147148
GlobalField globalField = client.GlobalField("");
148149
});
149150
}
Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
1-
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
6-
<IsPackable>false</IsPackable>
7-
<ReleaseVersion>$(Version)</ReleaseVersion>
8-
</PropertyGroup>
9-
10-
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
12-
<PackageReference Include="xunit" Version="2.9.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14-
<PrivateAssets>all</PrivateAssets>
15-
</PackageReference>
16-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
17-
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
18-
<PackageReference Include="coverlet.collector" Version="6.0.2">
19-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20-
<PrivateAssets>all</PrivateAssets>
21-
</PackageReference>
22-
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.2.10" />
23-
</ItemGroup>
24-
25-
<ItemGroup>
26-
<Reference Include="Contentstack.Core">
27-
<HintPath>..\Contentstack.Core\bin\Debug\Contentstack.Core.dll</HintPath>
28-
</Reference>
29-
</ItemGroup>
30-
<ItemGroup>
31-
<Compile Remove="SingletoneTest.cs" />
32-
<Compile Remove="EmptyClass.cs" />
33-
<Compile Remove="appSetings.cs" />
34-
<Compile Remove="TestResults\LocaleTest.cs" />
35-
<Compile Remove="LocalTest.cs" />
36-
</ItemGroup>
37-
<ItemGroup>
38-
<None Remove="stack.config" />
39-
<None Remove="Stack.config" />
40-
<None Remove="TestResults\.DS_Store" />
41-
<None Remove="TestResults\2018-09-29_19_56_27.trx" />
42-
<None Remove="TestResults\Prod_2018-09-30_13_16_23.trx" />
43-
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_00_07_58.trx" />
44-
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_19_54_44.trx" />
45-
<None Remove="appSetting.xml" />
46-
<None Remove="appsetting.json" />
47-
</ItemGroup>
48-
<ItemGroup>
49-
<ProjectReference Include="..\Contentstack.Core\Contentstack.Core.csproj" />
50-
</ItemGroup>
51-
<ItemGroup>
52-
<Folder Include="Models\" />
53-
</ItemGroup>
54-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
<ReleaseVersion>$(Version)</ReleaseVersion>
8+
<GenerateResourceFiles>false</GenerateResourceFiles>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<EmbeddedResource Remove="**/*.resx" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
17+
<PackageReference Include="xunit" Version="2.9.2" />
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
19+
<PrivateAssets>all</PrivateAssets>
20+
</PackageReference>
21+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
22+
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
23+
<PackageReference Include="coverlet.collector" Version="6.0.2">
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
<PrivateAssets>all</PrivateAssets>
26+
</PackageReference>
27+
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.2.10" />
28+
<PackageReference Include="AutoFixture" Version="4.18.1" />
29+
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
30+
<PackageReference Include="Moq" Version="4.20.72" />
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Reference Include="Contentstack.Core">
35+
<HintPath>..\Contentstack.Core\bin\Debug\Contentstack.Core.dll</HintPath>
36+
</Reference>
37+
</ItemGroup>
38+
<ItemGroup>
39+
<Compile Remove="SingletoneTest.cs" />
40+
<Compile Remove="EmptyClass.cs" />
41+
<Compile Remove="appSetings.cs" />
42+
<Compile Remove="TestResults\LocaleTest.cs" />
43+
<Compile Remove="LocalTest.cs" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<None Remove="stack.config" />
47+
<None Remove="Stack.config" />
48+
<None Remove="TestResults\.DS_Store" />
49+
<None Remove="TestResults\2018-09-29_19_56_27.trx" />
50+
<None Remove="TestResults\Prod_2018-09-30_13_16_23.trx" />
51+
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_00_07_58.trx" />
52+
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_19_54_44.trx" />
53+
<None Remove="appSetting.xml" />
54+
<None Remove="appsetting.json" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<ProjectReference Include="..\Contentstack.Core\Contentstack.Core.csproj" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Folder Include="Models\" />
61+
</ItemGroup>
62+
</Project>

0 commit comments

Comments
 (0)