Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ When you need to search the unity API, you can use :
# Build
dotnet build .\src\Microsoft.Unity.Analyzers.slnx

# Run tests
dotnet test .\src\Microsoft.Unity.Analyzers.slnx --filter FullyQualifiedName!~ConsistencyTests
# Run tests with Microsoft Testing Platform
dotnet .\src\Microsoft.Unity.Analyzers.Tests\bin\Debug\net10.0\Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3 --filter-not-class Microsoft.Unity.Analyzers.Tests.ConsistencyTests
```

Indeed we want to skip ConsistencyTests when developping new diagnostics because those tests are doing http-requests on documentation.
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
TESTINGPLATFORM_TELEMETRY_OPTOUT: 1
UNITY_HASH: '1c7db571dde0'
UNITY_FULL_VERSION: '6000.3.8f1'
HUSKY: 0
Expand Down Expand Up @@ -89,14 +90,14 @@ jobs:

- name: Test context (main)
if: github.ref == 'refs/heads/main'
run: echo "TEST_FILTER=." >> $GITHUB_ENV
run: echo "TEST_ARGUMENTS=--retry-failed-tests 3" >> "$GITHUB_ENV"
shell: bash

- name: Test context (feature)
if: github.ref != 'refs/heads/main'
run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV
run: echo "TEST_ARGUMENTS=--retry-failed-tests 3 --filter-not-class Microsoft.Unity.Analyzers.Tests.ConsistencyTests" >> "$GITHUB_ENV"
shell: bash

- name: Test
run: dotnet test -c Debug ./src/Microsoft.Unity.Analyzers.Tests --filter ${{env.TEST_FILTER}}
run: dotnet ./src/Microsoft.Unity.Analyzers.Tests/bin/Debug/net10.0/Microsoft.Unity.Analyzers.Tests.dll $TEST_ARGUMENTS
shell: bash
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ For unit-testing, we require Unity to be installed. We recommend using the lates
Compiling the solution:
`dotnet build .\src\Microsoft.Unity.Analyzers.slnx`

Running the unit tests:
`dotnet test .\src\Microsoft.Unity.Analyzers.slnx`
Running the unit tests with Microsoft Testing Platform and retrying failures up to three times:
`dotnet .\src\Microsoft.Unity.Analyzers.Tests\bin\Debug\net10.0\Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3`

You can open `.\src\Microsoft.Unity.Analyzers.slnx` in your favorite IDE to work on the analyzers and run/debug the tests.

Expand Down Expand Up @@ -92,5 +92,3 @@ Example for creating `CustomSuppressor` and `CustomSuppressorTests` classes :
This project welcomes contributions and suggestions.
Please have a look at our [Guidelines](CONTRIBUTING.md) for contributing.



5 changes: 3 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.14.2120" />
<!-- Tests -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.Retry" Version="2.3.3" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="10.0.11" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3" Version="4.0.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0" />
<!-- Misc -->
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<NoWarn>NU1608;VSTHRD200</NoWarn>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Testing.Extensions.Retry" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
<PackageReference Include="System.Reflection.MetadataLoadContext" />
<PackageReference Include="xunit.v3" />
Expand Down