Skip to content

Commit 089e4a0

Browse files
committed
- Update to .Net 10.0
- Rework snapshot helper and add png file snapshot support - Add xUnit V3 support - Update dependencies (Playwright...) - Remove FluentAssertions dependency
1 parent d8a75f0 commit 089e4a0

57 files changed

Lines changed: 1205 additions & 216 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/build-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14+
- name: Setup .NET Core
15+
uses: actions/setup-dotnet@v1
16+
with:
17+
dotnet-version: 10.0.101
1418
- name: Setup .NET Core
1519
uses: actions/setup-dotnet@v1
1620
with:
@@ -29,6 +33,8 @@ jobs:
2933
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.NUnit.UTest --configuration Release --no-restore --no-build
3034
- name: Test Helpers XUnit
3135
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.XUnit.UTest --configuration Release --no-restore --no-build
36+
- name: Test Helpers XUnit V3
37+
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.XUnit.V3.UTest --configuration Release --no-restore --no-build
3238
- name: Test E2E
3339
run: dotnet test ./src/tests/SoloX.CodeQuality.Playwright.E2ETest --configuration Release --no-restore --no-build
3440
- name: Upload Packages

.github/workflows/build-pr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14+
- name: Setup .NET Core
15+
uses: actions/setup-dotnet@v1
16+
with:
17+
dotnet-version: 10.0.101
1418
- name: Setup .NET Core
1519
uses: actions/setup-dotnet@v1
1620
with:
@@ -29,5 +33,7 @@ jobs:
2933
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.NUnit.UTest --configuration Release --no-restore --no-build
3034
- name: Test Helpers XUnit
3135
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.XUnit.UTest --configuration Release --no-restore --no-build
36+
- name: Test Helpers XUnit V3
37+
run: dotnet test ./src/tests/SoloX.CodeQuality.Test.Helpers.XUnit.V3.UTest --configuration Release --no-restore --no-build
3238
- name: Test E2E
3339
run: dotnet test ./src/tests/SoloX.CodeQuality.Playwright.E2ETest --configuration Release --no-restore --no-build

CodeQuality.sln

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.1.32414.318
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.3.11520.95
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoloX.CodeQuality.Prod", "src\libs\SoloX.CodeQuality.Prod\SoloX.CodeQuality.Prod.csproj", "{9785BB59-DC3D-46CF-B45C-DF4DBE6F0B2F}"
77
EndProject
@@ -56,6 +56,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.TestNuget
5656
EndProject
5757
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.PreReleaseTestNuget", "src\tests\SoloX.CodeQuality.PreReleaseTestNuget\SoloX.CodeQuality.PreReleaseTestNuget.csproj", "{FF0CCE33-32A5-4973-8A03-1763F513CE31}"
5858
EndProject
59+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.Test.Helpers.XUnit.V3", "src\libs\SoloX.CodeQuality.Test.Helpers.XUnit.V3\SoloX.CodeQuality.Test.Helpers.XUnit.V3.csproj", "{B7171425-0FD3-4029-8B26-6880240B2EFD}"
60+
EndProject
61+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoloX.CodeQuality.Test.Helpers.XUnit.V3.UTest", "src\tests\SoloX.CodeQuality.Test.Helpers.XUnit.V3.UTest\SoloX.CodeQuality.Test.Helpers.XUnit.V3.UTest.csproj", "{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE}"
62+
EndProject
5963
Global
6064
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6165
Debug|Any CPU = Debug|Any CPU
@@ -130,14 +134,22 @@ Global
130134
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Debug|Any CPU.Build.0 = Debug|Any CPU
131135
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Release|Any CPU.ActiveCfg = Release|Any CPU
132136
{FF0CCE33-32A5-4973-8A03-1763F513CE31}.Release|Any CPU.Build.0 = Release|Any CPU
137+
{B7171425-0FD3-4029-8B26-6880240B2EFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
138+
{B7171425-0FD3-4029-8B26-6880240B2EFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
139+
{B7171425-0FD3-4029-8B26-6880240B2EFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
140+
{B7171425-0FD3-4029-8B26-6880240B2EFD}.Release|Any CPU.Build.0 = Release|Any CPU
141+
{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
142+
{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
143+
{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
144+
{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE}.Release|Any CPU.Build.0 = Release|Any CPU
133145
EndGlobalSection
134146
GlobalSection(SolutionProperties) = preSolution
135147
HideSolutionNode = FALSE
136148
EndGlobalSection
137149
GlobalSection(NestedProjects) = preSolution
138150
{9785BB59-DC3D-46CF-B45C-DF4DBE6F0B2F} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
139151
{46DE472E-6200-47A1-9874-3B54952DFF81} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
140-
{B4ED680E-2B7B-4DFE-87E6-A3CBEE75C3DD} = {57F5BB2E-CD03-470B-BF16-31FE02A386B1}
152+
{B4ED680E-2B7B-4DFE-87E6-A3CBEE75C3DD} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
141153
{6FB11F33-250F-4DE8-934A-F63CDC8976D6} = {B1962CF8-DE8C-42AA-BC4E-99E99D722E26}
142154
{E4FAC4E6-2853-4464-B78F-6BAB619EEF8D} = {B1962CF8-DE8C-42AA-BC4E-99E99D722E26}
143155
{4D9D7FB7-CB50-4F61-92E7-A2CD669B15A7} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
@@ -152,6 +164,8 @@ Global
152164
{1F289698-A61C-4886-9E42-CFF9CDFD82E8} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
153165
{93418C7A-7C63-430B-8299-EEEE2FB83716} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
154166
{FF0CCE33-32A5-4973-8A03-1763F513CE31} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
167+
{B7171425-0FD3-4029-8B26-6880240B2EFD} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
168+
{B5C9E60A-0FB9-474F-BAAF-A6E0502352AE} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
155169
EndGlobalSection
156170
GlobalSection(ExtensibilityGlobals) = postSolution
157171
SolutionGuid = {74BCF463-5FDE-4DBC-B32A-431E8A228CA0}

src/SharedProperties.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<CodeQualityHeaderLicenseFile>LICENSE</CodeQualityHeaderLicenseFile>
1616

1717
<AssemblyVersion>2.3.6.0</AssemblyVersion>
18-
<LangVersion>12</LangVersion>
18+
<LangVersion>14</LangVersion>
1919

2020
</PropertyGroup>
2121

src/examples/SoloX.CodeQuality.Prod.Example/AClass2.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
using Microsoft.Extensions.Logging;
11+
using System;
1112
using System.Threading.Tasks;
1213

1314
namespace SoloX.CodeQuality.Prod.Example
@@ -53,7 +54,12 @@ public async Task<object> TestCase2Async()
5354
/// <param name="logger"></param>
5455
public void LogSomeThing(ILogger<AClass2> logger)
5556
{
56-
logger.LogInformation($"object is {this.test}");
57+
ArgumentNullException.ThrowIfNull(logger);
58+
59+
if (logger.IsEnabled(LogLevel.Information))
60+
{
61+
logger.LogInformation($"object is {this.test}");
62+
}
5763
}
5864
}
5965
}

src/examples/SoloX.CodeQuality.Prod.Example/SoloX.CodeQuality.Prod.Example.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Import Project="../../libs/SoloX.CodeQuality.Prod/build/SoloX.CodeQuality.Prod.targets" />
88

99
<PropertyGroup>
10-
<TargetFramework>net9.0</TargetFramework>
10+
<TargetFramework>net10.0</TargetFramework>
1111

1212
<CodeQualityHeaderEnable>true</CodeQualityHeaderEnable>
1313

@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
24+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
2525
</ItemGroup>
2626

2727
</Project>

src/examples/SoloX.CodeQuality.Test.Example/Class1.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// </copyright>
77
// ----------------------------------------------------------------------
88

9+
using System;
910
using Microsoft.Extensions.Logging;
1011

1112
namespace SoloX.CodeQuality.Test.Example
@@ -21,8 +22,12 @@ public static int MethodPublic()
2122

2223
public static int MethodPublicWithLogs(ILogger<object> logger, int varInt)
2324
{
25+
ArgumentNullException.ThrowIfNull(logger);
2426

25-
logger.LogInformation($"This is a log {varInt}");
27+
if (logger.IsEnabled(LogLevel.Information))
28+
{
29+
logger.LogInformation($"This is a log {varInt}");
30+
}
2631

2732
return TestCase.Length;
2833
}

src/examples/SoloX.CodeQuality.Test.Example/SoloX.CodeQuality.Test.Example.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Import Project="../../libs/SoloX.CodeQuality.Test/build/SoloX.CodeQuality.Test.targets" />
88

99
<PropertyGroup>
10-
<TargetFramework>net9.0</TargetFramework>
10+
<TargetFramework>net10.0</TargetFramework>
1111

1212
<CodeQualityUpdateGitIgnore>true</CodeQualityUpdateGitIgnore>
1313

@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
20+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
2121
</ItemGroup>
2222

2323
</Project>

src/libs/SoloX.CodeQuality.Playwright/PlaywrightDriver.cs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// </copyright>
77
// ----------------------------------------------------------------------
88

9-
using FluentAssertions;
109
using Microsoft.Playwright;
1110

1211
namespace SoloX.CodeQuality.Playwright
@@ -234,7 +233,10 @@ private async Task GotoPageInternalAsync(string url, Func<IPage, Task> testHandl
234233

235234
var page = await context.NewPageAsync().ConfigureAwait(false);
236235

237-
page.Should().NotBeNull();
236+
if (page == null)
237+
{
238+
throw new PlaywrightDriverException("Unable to create page");
239+
}
238240

239241
if (pageSetupHandler != null)
240242
{
@@ -244,11 +246,18 @@ private async Task GotoPageInternalAsync(string url, Func<IPage, Task> testHandl
244246
try
245247
{
246248
var gotoResult = await page.GotoAsync(url, new PageGotoOptions { WaitUntil = WaitUntilState.NetworkIdle, Timeout = 60000 }).ConfigureAwait(false);
247-
gotoResult.Should().NotBeNull();
249+
250+
if (gotoResult == null)
251+
{
252+
throw new PlaywrightDriverException("Unable to navigate to page");
253+
}
248254

249255
await gotoResult!.FinishedAsync().ConfigureAwait(false);
250256

251-
gotoResult.Ok.Should().BeTrue();
257+
if (!gotoResult.Ok)
258+
{
259+
throw new PlaywrightDriverException($"Unable to navigate to page (Status: {gotoResult.Status})");
260+
}
252261

253262
await testHandler(page).ConfigureAwait(false);
254263
}
@@ -335,4 +344,29 @@ public async ValueTask DisposeAsync()
335344
GC.SuppressFinalize(this);
336345
}
337346
}
347+
348+
/// <summary>
349+
/// PlaywrightDriver exception.
350+
/// </summary>
351+
public class PlaywrightDriverException : Exception
352+
{
353+
/// <summary>
354+
/// Setup instance with default message.
355+
/// </summary>
356+
public PlaywrightDriverException()
357+
{
358+
}
359+
/// <summary>
360+
/// Setup instance with default message.
361+
/// </summary>
362+
public PlaywrightDriverException(string? message) : base(message)
363+
{
364+
}
365+
/// <summary>
366+
/// Setup instance with default message.
367+
/// </summary>
368+
public PlaywrightDriverException(string? message, Exception? innerException) : base(message, innerException)
369+
{
370+
}
371+
}
338372
}

src/libs/SoloX.CodeQuality.Playwright/SoloX.CodeQuality.Playwright.csproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
<Import Project="../../SharedProperties.props" />
44

5-
<Import Condition=" '$(TargetFramework)' == 'net9.0'" Project="../../libs/SoloX.CodeQuality.Prod/build/SoloX.CodeQuality.Prod.props" />
5+
<Import Condition=" '$(TargetFramework)' == 'net10.0'" Project="../../libs/SoloX.CodeQuality.Prod/build/SoloX.CodeQuality.Prod.props" />
66

7-
<Import Condition=" '$(TargetFramework)' == 'net9.0'" Project="../../libs/SoloX.CodeQuality.Prod/build/SoloX.CodeQuality.Prod.targets" />
7+
<Import Condition=" '$(TargetFramework)' == 'net10.0'" Project="../../libs/SoloX.CodeQuality.Prod/build/SoloX.CodeQuality.Prod.targets" />
88

99
<PropertyGroup>
10-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
10+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
1111
<ImplicitUsings>enable</ImplicitUsings>
1212
<Nullable>enable</Nullable>
1313

@@ -18,8 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="FluentAssertions" Version="6.12.2" />
22-
<PackageReference Include="Microsoft.Playwright" Version="1.49.0" />
21+
<PackageReference Include="Microsoft.Playwright" Version="1.58.0" />
2322
</ItemGroup>
2423

2524
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
@@ -30,6 +29,10 @@
3029
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="[9.0.0,)" />
3130
</ItemGroup>
3231

32+
<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
33+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="[10.0.0,)" />
34+
</ItemGroup>
35+
3336
<ItemGroup>
3437
<ProjectReference Include="..\SoloX.CodeQuality.WebHost\SoloX.CodeQuality.WebHost.csproj" />
3538
</ItemGroup>

0 commit comments

Comments
 (0)