diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1dbdc8af..3f6b07d58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: run: dotnet build --no-restore --configuration Debug - name: Run tests - run: dotnet test --no-build --configuration Debug --collect:"XPlat Code Coverage" + run: dotnet test --no-build --configuration Debug --collect:"Code Coverage;Format=cobertura;CoverageFileName=coverage.cobertura.xml" - name: Upload coverage reports to Codecov uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 diff --git a/Directory.Packages.props b/Directory.Packages.props index 9d3f94001..fa980e86e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,8 +7,6 @@ - - @@ -17,15 +15,13 @@ - - - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 6d7eee3be..fc41b98c9 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -3,8 +3,7 @@ - - + diff --git a/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj b/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj index 8e9b5955a..5618dac4a 100644 --- a/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj @@ -5,11 +5,9 @@ - - diff --git a/test/Microsoft.ComponentDetection.Contracts.Tests/Microsoft.ComponentDetection.Contracts.Tests.csproj b/test/Microsoft.ComponentDetection.Contracts.Tests/Microsoft.ComponentDetection.Contracts.Tests.csproj index 1d6761936..8f8b8cdd0 100644 --- a/test/Microsoft.ComponentDetection.Contracts.Tests/Microsoft.ComponentDetection.Contracts.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Contracts.Tests/Microsoft.ComponentDetection.Contracts.Tests.csproj @@ -5,9 +5,7 @@ - - diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs index 319f75391..2075ae463 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs @@ -1,4 +1,4 @@ -namespace Microsoft.ComponentDetection.Detectors.Tests; +namespace Microsoft.ComponentDetection.Detectors.Tests; using System; using FluentAssertions; @@ -31,6 +31,7 @@ public void ConstructorTest_NameVersion() [TestMethod] [ExpectedException(typeof(ArgumentNullException))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "MSTEST0006:Avoid '[ExpectedException]'", Justification = "Single-line test case")] public void ConstructorTest_NameVersion_NullVersion() { var goComponent = new GoComponent(TestName, null); @@ -38,6 +39,7 @@ public void ConstructorTest_NameVersion_NullVersion() [TestMethod] [ExpectedException(typeof(ArgumentNullException))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "MSTEST0006:Avoid '[ExpectedException]'", Justification = "Single-line test case")] public void ConstructorTest_NameVersion_NullName() { var goComponent = new GoComponent(null, TestVersion); @@ -55,6 +57,7 @@ public void ConstructorTest_NameVersionHash() [TestMethod] [ExpectedException(typeof(ArgumentNullException))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "MSTEST0006:Avoid '[ExpectedException]'", Justification = "Single-line test case")] public void ConstructorTest_NameVersionHash_NullVersion() { var goComponent = new GoComponent(TestName, null, TestHash); @@ -62,6 +65,7 @@ public void ConstructorTest_NameVersionHash_NullVersion() [TestMethod] [ExpectedException(typeof(ArgumentNullException))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "MSTEST0006:Avoid '[ExpectedException]'", Justification = "Single-line test case")] public void ConstructorTest_NameVersionHash_NullName() { var goComponent = new GoComponent(null, TestVersion, TestHash); @@ -69,6 +73,7 @@ public void ConstructorTest_NameVersionHash_NullName() [TestMethod] [ExpectedException(typeof(ArgumentNullException))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "MSTEST0006:Avoid '[ExpectedException]'", Justification = "Single-line test case")] public void ConstructorTest_NameVersionHash_NullHash() { var goComponent = new GoComponent(TestName, TestVersion, null); diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs index eac9b8c7c..78fda3b09 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs @@ -185,7 +185,8 @@ public async Task GenerateDependenciesFile_SuccessWithTimeoutVariableTimeoutAsyn this.environmentVarServiceMock .Setup(x => x.GetEnvironmentVariable(MavenCommandService.MvnCLIFileLevelTimeoutSecondsEnvVar)) - .Returns("0"); + .Returns("0") + .Callback(() => cts.Cancel()); this.commandLineMock.Setup(x => x.ExecuteCommandAsync( MavenCommandService.PrimaryCommand, @@ -260,7 +261,7 @@ public void ParseDependenciesFile_Success() protected bool ShouldBeEquivalentTo(IEnumerable result, IEnumerable expected) { - result.Should().BeEquivalentTo(expected); + result.Should().BeEquivalentTo(expected); return true; } } diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj b/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj index 6572a0488..6e7e24dbc 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj @@ -6,10 +6,8 @@ - - diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Microsoft.ComponentDetection.Orchestrator.Tests.csproj b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Microsoft.ComponentDetection.Orchestrator.Tests.csproj index 45738a84d..3bffac99c 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Microsoft.ComponentDetection.Orchestrator.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Microsoft.ComponentDetection.Orchestrator.Tests.csproj @@ -6,9 +6,7 @@ - - diff --git a/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj b/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj index 049cec2a5..fceb0cc25 100644 --- a/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj +++ b/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj @@ -12,15 +12,13 @@ - - - - +