Skip to content

Commit 1cb4698

Browse files
committed
Merge remote-tracking branch 'origin/tests/DX-3676' into fix/DX-3455-error-message-improve
2 parents 87592d7 + 374c9ce commit 1cb4698

Some content is hidden

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

48 files changed

+15630
-382
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/[email protected]
12+
- name: Setup .NET 7.0
13+
uses: actions/[email protected]
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+

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task FetchContenTypeSchema()
2222
var result = await contenttype.Fetch();
2323
if (result == null)
2424
{
25-
Assert.False(true, "contenttype.FetchSchema() is not match with expected result.");
25+
Assert.Fail( "contenttype.FetchSchema() is not match with expected result.");
2626
}
2727
else
2828
{
@@ -39,7 +39,7 @@ public async Task FetchContenTypeSchemaIncludeGlobalFields()
3939
var result = await contenttype.Fetch(param);
4040
if (result == null)
4141
{
42-
Assert.False(true, "contenttype.FetchSchema() is not match with expected result.");
42+
Assert.Fail( "contenttype.FetchSchema() is not match with expected result.");
4343
}
4444
else
4545
{
@@ -54,7 +54,7 @@ public async Task GetContentTypes()
5454

5555
if (result == null)
5656
{
57-
Assert.False(true, "client.getContentTypes is not match with expected result.");
57+
Assert.Fail( "client.getContentTypes is not match with expected result.");
5858
}
5959
else
6060
{
@@ -73,7 +73,7 @@ public async Task GetContentTypesIncludeGlobalFields()
7373

7474
if (result == null)
7575
{
76-
Assert.False(true, "client.getContentTypes is not match with expected result.");
76+
Assert.Fail( "client.getContentTypes is not match with expected result.");
7777
}
7878
else
7979
{
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)