diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 125618185..d3a301d78 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -40,7 +40,6 @@ extends: os: windows demands: - msbuild - - vstest customBuildTags: - ES365AIMigrationTooling stages: @@ -111,19 +110,20 @@ extends: projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln' arguments: '--configuration $(BuildConfiguration) --no-incremental' - # Both suites are in the solution, but SDK10 cannot run MTP via VSTest. - # Keep OData on VSTest and invoke the hidi MTP executable separately (#885). - - task: DotNetCoreCLI@2 - displayName: 'test' - inputs: - command: test - projects: '$(Build.SourcesDirectory)\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj' - arguments: '--configuration $(BuildConfiguration) --no-build' - - pwsh: | - dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c $(BuildConfiguration) --no-build -- --minimum-expected-tests 1 + dotnet test --solution Microsoft.OpenApi.OData.sln -c $(buildConfiguration) --no-build --results-directory '$(Agent.TempDirectory)\TestResults' -- --minimum-expected-tests 1 --report-trx --report-azdo if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - displayName: 'Test hidi (Microsoft.Testing.Platform)' + displayName: 'Test solution (Microsoft.Testing.Platform)' + + - task: PublishTestResults@2 + displayName: 'Publish solution test results' + condition: succeededOrFailed() + inputs: + testResultsFormat: VSTest + testResultsFiles: '$(Agent.TempDirectory)\TestResults\*.trx' + mergeTestResults: true + failTaskOnFailedTests: true + failTaskOnMissingResultsFile: true - task: EsrpCodeSigning@6 displayName: 'ESRP CodeSigning' diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml index 706b956d8..342aa551a 100644 --- a/.azure-pipelines/hidi-release.yml +++ b/.azure-pipelines/hidi-release.yml @@ -135,8 +135,21 @@ extends: $ErrorActionPreference = 'Stop' dotnet build src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) -p:GeneratePackageOnBuild=false if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c $(buildConfiguration) -- --minimum-expected-tests 1 + displayName: Build hidi + - pwsh: | + dotnet test --solution Microsoft.OpenApi.OData.sln -c $(buildConfiguration) --results-directory '$(Agent.TempDirectory)\TestResults' -- --minimum-expected-tests 1 --report-trx --report-azdo if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + displayName: Test solution (Microsoft.Testing.Platform) + - task: PublishTestResults@2 + displayName: Publish solution test results + condition: succeededOrFailed() + inputs: + testResultsFormat: VSTest + testResultsFiles: '$(Agent.TempDirectory)\TestResults\*.trx' + mergeTestResults: true + failTaskOnFailedTests: true + failTaskOnMissingResultsFile: true + - pwsh: | dotnet publish src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PackAsTool=false -p:GeneratePackageOnBuild=false -o artifacts\hidi\win-x64 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } & .\artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe --help @@ -144,7 +157,7 @@ extends: New-Item -ItemType Directory -Force artifacts\hidi\signing | Out-Null Copy-Item src\Microsoft.OpenApi.Hidi\bin\$(buildConfiguration)\net8.0\Microsoft.OpenApi.Hidi.dll artifacts\hidi\signing Copy-Item artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe artifacts\hidi\signing - displayName: Build, test and stage hidi binaries + displayName: Stage hidi binaries - task: EsrpCodeSigning@6 displayName: Sign hidi DLL and Windows executable inputs: diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index e52b10858..e34580d63 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -89,22 +89,18 @@ jobs: id: run_unit_tests shell: pwsh run: | - $testProjectsArray = @( - '.\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj' - ) - - $testProjectsArray | ForEach-Object { - dotnet test $PSItem ` - -c Release - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - } - - - name: Run hidi tests (Microsoft.Testing.Platform) - shell: pwsh - run: | - dotnet run --project .\test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release -- --minimum-expected-tests 1 + $resultsDirectory = Join-Path $PWD 'artifacts' 'test-results' + dotnet test --solution Microsoft.OpenApi.OData.sln -c Release -p:EnableWindowsTargeting=true --results-directory $resultsDirectory -- --minimum-expected-tests 1 --report-trx --report-gh if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Upload test results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results + path: artifacts/test-results + if-no-files-found: error + - name: Pack and install hidi locally shell: pwsh run: | diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 32ef64ba5..6366f138c 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -122,30 +122,46 @@ jobs: - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - CollectCoverage: true - CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682 shell: pwsh run: | - dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.net8.0.opencover.xml,artifacts/hidi/coverage/*opencover*.xml" /d:sonar.coverageReportPaths="artifacts/hidi/powershell-coverage/sonar-coverage.xml" + dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="artifacts/test-results/*opencover*.xml" /d:sonar.coverageReportPaths="artifacts/hidi/powershell-coverage/sonar-coverage.xml" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet workload restore if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet build if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet test test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + dotnet test --solution Microsoft.OpenApi.OData.sln --no-build --results-directory artifacts\test-results -- --minimum-expected-tests 1 --report-trx --report-gh --coverlet --coverlet-output-format opencover --coverlet-include "[Microsoft.OpenApi.OData.Reader]*" --coverlet-include "[Microsoft.OpenApi.Hidi]*" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj --no-build -- --minimum-expected-tests 1 --coverlet --coverlet-output-format opencover --coverlet-include "[Microsoft.OpenApi.Hidi]*" --results-directory artifacts\hidi\coverage - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - $reports = @(Get-ChildItem artifacts\hidi\coverage -Filter '*opencover*.xml') - if ($reports.Count -eq 0) { throw "Hidi OpenCover report was not generated." } - $hidiModules = @($reports | ForEach-Object { - ([xml](Get-Content $_.FullName -Raw)).CoverageSession.Modules.Module - } | Where-Object { $_.ModuleName -eq 'Microsoft.OpenApi.Hidi' }) - if (-not ($hidiModules | Where-Object { - $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint').Count -gt 0 -and - $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]').Count -gt 0 - })) { - throw "Hidi OpenCover report contains no covered Hidi sequence points." + $reports = @(Get-ChildItem artifacts\test-results -Filter '*opencover*.xml') + if ($reports.Count -ne 2) { throw "Expected an OpenCover report from each test project." } + $modules = @($reports | ForEach-Object { + $report = [xml](Get-Content $_.FullName -Raw) + if ($report.SelectNodes('//SequencePoint').Count -eq 0 -or + $report.SelectNodes('//SequencePoint[@vc > 0]').Count -eq 0) { + throw "OpenCover report contains no covered sequence points: $($_.Name)" + } + $report.CoverageSession.Modules.Module + }) + $expectedModules = @('Microsoft.OpenApi.OData.Reader', 'Microsoft.OpenApi.Hidi') + if ($modules | Where-Object { $_.ModuleName -notin $expectedModules }) { + throw "OpenCover reports contain unexpected modules." + } + foreach ($moduleName in $expectedModules) { + if (-not ($modules | Where-Object { + $_.ModuleName -eq $moduleName -and + $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint').Count -gt 0 -and + $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]').Count -gt 0 + })) { + throw "OpenCover reports contain no covered sequence points for $moduleName." + } } dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + - name: Upload test and coverage results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: sonar-test-results + path: artifacts/test-results + if-no-files-found: error diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 097a05672..4f31b9c3a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,10 +21,21 @@ "group": "test", "args": [ "test", + "--solution", "${workspaceFolder}/Microsoft.OpenApi.OData.sln", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary", - "--collect:\"XPlat Code Coverage\"" + "-p:EnableWindowsTargeting=true", + "--results-directory", + "${workspaceFolder}/artifacts/test-results", + "--", + "--minimum-expected-tests", + "1", + "--coverlet", + "--coverlet-output-format", + "cobertura", + "--coverlet-include", + "[Microsoft.OpenApi.OData.Reader]*", + "--coverlet-include", + "[Microsoft.OpenApi.Hidi]*" ], "problemMatcher": "$msCompile" }, @@ -35,15 +46,15 @@ "linux": { "command": "rm", "args": [ - "-r", - "${workspaceFolder}/test/Microsoft.OpenAPI.OData.Reader.Tests/TestResults" + "-rf", + "${workspaceFolder}/artifacts/test-results" ] }, "windows": { "command": "powershell", "args": [ "-command", - "Remove-Item -Recurse -Include TestResults -Path ${workspaceFolder}/tests" + "if (Test-Path -LiteralPath '${workspaceFolder}/artifacts/test-results') { Remove-Item -Recurse -LiteralPath '${workspaceFolder}/artifacts/test-results' }" ] } }, @@ -54,14 +65,14 @@ "linux":{ "command": "reportgenerator", "args": [ - "-reports:${workspaceFolder}/tests/**/coverage.cobertura.xml", + "-reports:${workspaceFolder}/artifacts/test-results/*cobertura*.xml", "-targetdir:${workspaceFolder}/reports/coverage" ], }, "windows": { "command": "reportgenerator", "args": [ - "-reports:${workspaceFolder}\\test\\**\\coverage.cobertura.xml", + "-reports:${workspaceFolder}\\artifacts\\test-results\\*cobertura*.xml", "-targetdir:${workspaceFolder}\\reports\\coverage" ] }, @@ -72,7 +83,7 @@ "dependsOrder": "sequence" }, { - "label": "coverage:launch", + "label": "coverage:open", "type": "shell", "linux": { "command": "xdg-open", @@ -100,7 +111,7 @@ "dependsOrder": "sequence", "dependsOn": [ "coverage:unit", - "coverage:launch" + "coverage:open" ] }, { diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d22c016dd..38f1d133f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,39 @@ OpenAPI.net.OData is a mono-repo containing source code for the following packag |----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Microsoft.OpenAPI.OData](./README.md) | [![NuGet Version](https://img.shields.io/nuget/vpre/Microsoft.OpenAPI.OData?label=Latest&logo=nuget)](https://www.nuget.org/packages/Microsoft.OpenAPI.OData/) | +## Building and testing + +[Microsoft.OpenApi.Hidi](src/Microsoft.OpenApi.Hidi/readme.md) is a .NET tool, +not an OData library package. Install the .NET 10 SDK and .NET 8 runtime to build +and test both projects. Both test projects use xUnit v3 and +Microsoft.Testing.Platform, selected by `global.json`. Reader tests still target +.NET 8; Hidi tests target .NET 10. + +```powershell +dotnet build Microsoft.OpenApi.OData.sln -c Release +dotnet test --solution Microsoft.OpenApi.OData.sln -c Release --no-build -- --minimum-expected-tests 1 +``` + +On non-Windows hosts, pass `-p:EnableWindowsTargeting=true` to both commands +because the solution also contains the Windows-only GUI project. +Use `--project ` instead of `--solution ` for a single test project. +MTP options replace VSTest's `--logger`, `--collect`, and MSBuild coverage options: + +```powershell +dotnet test --solution Microsoft.OpenApi.OData.sln -c Release --no-build --results-directory artifacts\test-results -- --minimum-expected-tests 1 --report-trx --coverlet --coverlet-output-format cobertura --coverlet-include "[Microsoft.OpenApi.OData.Reader]*" --coverlet-include "[Microsoft.OpenApi.Hidi]*" +``` + +This produces separate TRX and coverage reports for each test assembly. +CI uses `--report-gh` for GitHub Actions and `--report-azdo` with TRX publication +for Azure DevOps. SonarCloud collects OpenCover reports for both projects in +`artifacts/test-results`, alongside the separately measured Pester helper coverage. + +Each test project's `testconfig.json` explicitly includes its product assembly. +Keep these files copied to the output directory: CLI include filters alone can +produce an empty Reader report with Coverlet's dynamic namespace exclusions. +SonarCloud rejects empty reports and unexpected modules, and requires covered +sequence points for both Reader and Hidi. + OpenAPI.net.OData is open to contributions. There are a couple of different recommended paths to get contributions into the released version of this library. __NOTE__ A signed a contribution license agreement is required for all contributions, and is checked automatically on new pull requests. Please read and sign [the agreement](https://cla.microsoft.com/) before starting any work for this repository. diff --git a/README.md b/README.md index 5169836ef..dd3615e04 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,12 @@ are accepted, a fresh official publish-disabled build verifies the packaged Hidi DLL's signature and hash, and the source main publisher is retired for cutover. See [the release prerequisites](src/Microsoft.OpenApi.Hidi/readme.md#release-cutover-prerequisites). +Both test projects use xUnit v3 and +Microsoft.Testing.Platform; OData tests still target .NET 8. Run them together +with `dotnet test --solution Microsoft.OpenApi.OData.sln -c Release -- --minimum-expected-tests 1` +(add `-p:EnableWindowsTargeting=true` on non-Windows hosts). See +[contributing](CONTRIBUTING.md#building-and-testing) for coverage and reporting commands. + --- # Contributing diff --git a/build.ps1 b/build.ps1 index 6186dd8fc..99a056e4c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -103,10 +103,7 @@ ForEach ($ver in $SNVersions) } # Other variables -$ProductProj = $ENLISTMENT_ROOT + "\src\Microsoft.OpenAPI.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj" -$TESTProj = $ENLISTMENT_ROOT + "\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenApi.OData.Reader.Tests.csproj" -$HidiProj = $ENLISTMENT_ROOT + "\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj" -$HidiTESTProj = $ENLISTMENT_ROOT + "\test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj" +$Solution = $ENLISTMENT_ROOT + "\Microsoft.OpenApi.OData.sln" $TESTDIR = $ENLISTMENT_ROOT + "\bin\$Configuration\Test\net472" $PRODUCTDIR = $ENLISTMENT_ROOT + "\bin\$Configuration\net472" @@ -188,18 +185,9 @@ Function BuildProcess $script:BUILD_START_TIME = Get-Date - Write-Host "Build Product ..." + Write-Host "Build Solution ..." - & dotnet.exe build $ProductProj -c $Configuration - - Write-Host "Build Test ..." - - & dotnet.exe build $TESTProj -c $Configuration - - Write-Host "Build Hidi ..." - & dotnet.exe build $HidiProj -c $Configuration - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & dotnet.exe build $HidiTESTProj -c $Configuration + & dotnet.exe build $Solution -c $Configuration if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Build Done" -ForegroundColor $Success @@ -212,10 +200,7 @@ Function TestProcess $script:TEST_START_TIME = Get-Date - & dotnet test $TESTProj -c $Configuration - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - & dotnet run --project $HidiTESTProj -c $Configuration --no-build -- --minimum-expected-tests 1 + & dotnet test --solution $Solution -c $Configuration --no-build -- --minimum-expected-tests 1 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Test Done" -ForegroundColor $Success diff --git a/global.json b/global.json index d46d21e50..df32a2e39 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "10.0.100", "rollForward": "latestFeature", "allowPrerelease": false + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index b42640a0d..11f073999 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -48,21 +48,23 @@ the newly built artifact, not the already-published package with the same versio ### Tests and coverage -Hidi tests use Microsoft.Testing.Platform; the existing OData tests continue to -use VSTest. Run Hidi tests and collect coverage independently: +Both Reader and Hidi tests use xUnit v3 and Microsoft.Testing.Platform, selected +by the repository's `global.json`. Run both suites from the solution, or select +just Hidi with `--project`: ```powershell -dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release -- --minimum-expected-tests 1 -dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release --no-build -- --minimum-expected-tests 1 --coverlet --results-directory artifacts\hidi\coverage +dotnet test --solution Microsoft.OpenApi.OData.sln -c Release -- --minimum-expected-tests 1 +dotnet test --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release --no-build --results-directory artifacts\hidi\coverage -- --minimum-expected-tests 1 --coverlet --coverlet-output-format opencover --coverlet-include "[Microsoft.OpenApi.Hidi]*" ``` -The Hidi-only `testconfig.json` explicitly includes the Hidi assembly and excludes -test/generated code. This authoritative configuration prevents Coverlet's -dynamic namespace exclusions from excluding `Microsoft.OpenApi.Hidi` itself. -The Sonar workflow requires an OpenCover report with covered Hidi sequence points. -Repository-wide MTP migration is tracked separately in -[#885](https://github.com/microsoft/OpenAPI.NET.OData/issues/885); this migration -does not change the existing OData test platform. +Each test project's `testconfig.json` explicitly includes its product assembly +and excludes test/generated code. This authoritative configuration prevents +Coverlet's dynamic namespace exclusions from excluding the product itself. +The Sonar workflow runs one solution-wide test command and requires separate +OpenCover reports with covered Reader and Hidi sequence points. +On non-Windows hosts, add `-p:EnableWindowsTargeting=true` to solution commands. +See [contributing](../../CONTRIBUTING.md#building-and-testing) for solution-wide +coverage and CI reporting options. ### Official NuGet releases diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/EdmModelHelper.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/EdmModelHelper.cs index a7d5841c3..cbbeffbce 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/EdmModelHelper.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/EdmModelHelper.cs @@ -15,7 +15,6 @@ using System.Collections.Generic; using System.Text; using Microsoft.OData.Edm.Validation; -using Xunit.Abstractions; namespace Microsoft.OpenApi.OData.Tests { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/OpenApiTestBase.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/OpenApiTestBase.cs index b944fe828..52b437b34 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/OpenApiTestBase.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Common/OpenApiTestBase.cs @@ -3,7 +3,7 @@ // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------ -using Xunit.Abstractions; +using Xunit; namespace Microsoft.OpenApi.OData.Tests { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/EdmModelOpenApiExtensionsTest.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/EdmModelOpenApiExtensionsTest.cs index 3c1326e97..bf071c541 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/EdmModelOpenApiExtensionsTest.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/EdmModelOpenApiExtensionsTest.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Microsoft.OData.Edm; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.OData.Tests; public class EdmModelOpenApiExtensionsTest(ITestOutputHelper output) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiEdmTypeSchemaGeneratorTest.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiEdmTypeSchemaGeneratorTest.cs index 52bc0a8e4..5e7a04f3b 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiEdmTypeSchemaGeneratorTest.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiEdmTypeSchemaGeneratorTest.cs @@ -11,7 +11,6 @@ using Microsoft.OpenApi.OData.Edm; using Microsoft.OpenApi.OData.Generator; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.OData.Tests { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs index 447acb948..6f9b18ad6 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs @@ -12,7 +12,6 @@ using Microsoft.OpenApi.OData.Edm; using Microsoft.OpenApi.OData.Generator; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.OData.Tests { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj b/test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj index 806a65172..077c70618 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj @@ -4,6 +4,10 @@ Microsoft.OpenApi.OData.Reader.Tests Microsoft.OpenApi.OData.Reader.Tests net8.0 + Exe + true + false + true latest true ..\..\tool\Microsoft.OpenApi.OData.snk @@ -80,25 +84,22 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + PreserveNewest + + + diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/testconfig.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/testconfig.json new file mode 100644 index 000000000..f8d7a0194 --- /dev/null +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/testconfig.json @@ -0,0 +1,12 @@ +{ + "platformOptions": { + "Coverlet": { + "include": "[Microsoft.OpenApi.OData.Reader]*", + "exclude": "[*.Tests]*", + "excludeByAttribute": "GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute", + "format": "opencover", + "includeTestAssembly": false, + "excludeAssembliesWithoutSources": "MissingAll" + } + } +} diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d7124bd09..f8ce2600c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -2,6 +2,8 @@ net10.0 + Exe + true enable enable @@ -17,9 +19,9 @@ - +