Skip to content

Commit 943ddc2

Browse files
XUnit V3
1 parent 3a373e0 commit 943ddc2

File tree

7 files changed

+37
-24
lines changed

7 files changed

+37
-24
lines changed

.github/workflows/dotnet-build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,19 @@ jobs:
189189
- name: 'Build CommunityToolkit.Maui'
190190
run: dotnet build ${{ env.PathToLibrarySolution }} -c Release -p:PackageVersion=${{ env.NugetPackageVersion }} -p:Version=${{ env.NugetPackageVersion }}
191191

192-
- name: Run All Unit Tests
193-
run: dotnet test -c Release ${{ env.PathToLibrarySolution }} --settings ".runsettings" --collect "XPlat code coverage" --logger trx --results-directory ${{ runner.temp }} --logger GitHubActions
192+
- name: Run CommunityToolkit Analyzers UnitTests
193+
run: dotnet run -c Release ${{ env.PathToCommunityToolkitAnalyzersUnitTestCsproj }} --results-directory "${{ runner.temp }}" --coverage --coverage-output "${{ runner.temp }}/ut-analyzers.cobertura.xml" --coverage-output-format cobertura --report-xunit
194+
195+
- name: Run CommunityToolkit UnitTests
196+
run: dotnet run -c Release ${{ env.PathToCommunityToolkitUnitTestCsproj }} --results-directory "${{ runner.temp }}" --coverage --coverage-output "${{ runner.temp }}/ut.cobertura.xml" --coverage-output-format cobertura --report-xunit
194197

195198
- name: Publish Test Results
196199
if: runner.os == 'Windows'
197200
uses: actions/upload-artifact@v4
198201
with:
199202
name: Test Results
200203
path: |
201-
${{ runner.temp }}/**/*.trx
204+
${{ runner.temp }}
202205
203206
- name: Pack CommunityToolkit.Maui.Core NuGet
204207
run: dotnet pack -c Release ${{ env.PathToCommunityToolkitCoreCsproj }} -p:PackageVersion=${{ env.NugetPackageVersion }}

samples/CommunityToolkit.Maui.Sample.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
..\.editorconfig = ..\.editorconfig
1515
..\Directory.Build.props = ..\Directory.Build.props
1616
..\Directory.Build.targets = ..\Directory.Build.targets
17+
..\.github\workflows\dotnet-build.yml = ..\.github\workflows\dotnet-build.yml
1718
..\global.json = ..\global.json
1819
EndProjectSection
1920
EndProject

src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(NetVersion)</TargetFramework>
5-
<IsPackable>false</IsPackable>
65
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
76
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GF</CompilerGeneratedFilesOutputPath>
87
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
98
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
9+
10+
<OutputType>Exe</OutputType>
11+
<RootNamespace>CommunityToolkit.Maui.Analyzers.UnitTests</RootNamespace>
12+
13+
<TestingPlatformDotnetTestSupport>false</TestingPlatformDotnetTestSupport>
14+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
1015
</PropertyGroup>
1116

1217
<ItemGroup>
13-
<PackageReference Include="FluentAssertions" Version="8.0.1" />
14-
<PackageReference Include="FluentAssertions.Analyzers" Version="0.34.1" />
15-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.2" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
18-
<PackageReference Include="xunit" Version="2.9.3" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1" PrivateAssets="All" />
20-
<PackageReference Include="coverlet.collector" Version="6.0.4" PrivateAssets="All" />
18+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
23+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
24+
<PackageReference Include="xunit.v3" Version="1.0.1" />
25+
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.1" />
2126
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" />
22-
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiPackageVersion)" />
23-
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" PrivateAssets="All" />
2427
</ItemGroup>
2528

2629
<ItemGroup>
2730
<!--Fix vulnerabilities-->
2831
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
32+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
33+
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
2934
</ItemGroup>
3035

3136
<ItemGroup>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json"
3+
}

src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>$(NetVersion)</TargetFramework>
5-
<OutputType>exe</OutputType>
6-
<IsPackable>false</IsPackable>
75
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
86
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GF</CompilerGeneratedFilesOutputPath>
7+
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>CommunityToolkit.Maui.UnitTests</RootNamespace>
10+
11+
<TestingPlatformDotnetTestSupport>false</TestingPlatformDotnetTestSupport>
12+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
913
</PropertyGroup>
1014

1115
<ItemGroup>
1216
<PackageReference Include="FluentAssertions" Version="8.0.1" />
1317
<PackageReference Include="FluentAssertions.Analyzers" Version="0.34.1" />
1418
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1619
<PackageReference Include="xunit.v3" Version="1.0.1" />
17-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1" PrivateAssets="All" />
18-
<PackageReference Include="coverlet.collector" Version="6.0.4" PrivateAssets="All" />
19-
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiPackageVersion)"/>
20-
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" PrivateAssets="All" />
2120
</ItemGroup>
2221

2322
<ItemGroup>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = false)]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"parallelizeAssembly": false,
3-
"parallelizeTestCollections": false
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json"
43
}

0 commit comments

Comments
 (0)