diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1dbdc8a..3f6b07d5 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 9d3f9400..fa980e86 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 6d7eee3b..fc41b98c 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 8e9b5955..5618dac4 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 1d676193..8f8b8cdd 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 319f7539..2075ae46 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 class GoComponentTests [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 class GoComponentTests [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 class GoComponentTests [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 class GoComponentTests [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 class GoComponentTests [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 eac9b8c7..78fda3b0 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/MavenCommandServiceTests.cs @@ -185,7 +185,8 @@ public class MavenCommandServiceTests 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 class MavenCommandServiceTests 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 6572a048..6e7e24db 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 45738a84..3bffac99 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 049cec2a..fceb0cc2 100644 --- a/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj +++ b/test/Microsoft.ComponentDetection.VerificationTests/Microsoft.ComponentDetection.VerificationTests.csproj @@ -12,15 +12,13 @@ - - - - +