diff --git a/Directory.Packages.props b/Directory.Packages.props
index 29c6c385f..d8f1995e6 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -21,9 +21,9 @@
-
-
-
+
+
+
diff --git a/test/Microsoft.ComponentDetection.Common.Tests/AssemblyInfo.cs b/test/Microsoft.ComponentDetection.Common.Tests/AssemblyInfo.cs
new file mode 100644
index 000000000..be2dce49a
--- /dev/null
+++ b/test/Microsoft.ComponentDetection.Common.Tests/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
diff --git a/test/Microsoft.ComponentDetection.Contracts.Tests/AssemblyInfo.cs b/test/Microsoft.ComponentDetection.Contracts.Tests/AssemblyInfo.cs
new file mode 100644
index 000000000..be2dce49a
--- /dev/null
+++ b/test/Microsoft.ComponentDetection.Contracts.Tests/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/AssemblyInfo.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/AssemblyInfo.cs
new file mode 100644
index 000000000..be2dce49a
--- /dev/null
+++ b/test/Microsoft.ComponentDetection.Detectors.Tests/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs
index 2075ae463..fe1c3377a 100644
--- a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs
+++ b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentTests.cs
@@ -30,19 +30,17 @@ 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);
+ var action = () => new GoComponent(TestName, null);
+ action.Should().ThrowExactly();
}
[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);
+ var action = () => new GoComponent(null, TestVersion);
+ action.Should().ThrowExactly();
}
[TestMethod]
@@ -56,27 +54,24 @@ 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);
+ var action = () => new GoComponent(TestName, null, TestHash);
+ action.Should().ThrowExactly();
}
[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);
+ var action = () => new GoComponent(null, TestVersion, TestHash);
+ action.Should().ThrowExactly();
}
[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);
+ var action = () => new GoComponent(TestName, TestVersion, null);
+ action.Should().ThrowExactly();
}
[TestMethod]
diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/AssemblyInfo.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/AssemblyInfo.cs
new file mode 100644
index 000000000..be2dce49a
--- /dev/null
+++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
diff --git a/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestIfNotWindowsAttribute.cs b/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestIfNotWindowsAttribute.cs
index 26289d9b2..7930749f3 100644
--- a/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestIfNotWindowsAttribute.cs
+++ b/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestIfNotWindowsAttribute.cs
@@ -1,24 +1,36 @@
namespace Microsoft.ComponentDetection.TestsUtilities;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
public sealed class SkipTestIfNotWindowsAttribute : TestMethodAttribute
{
- public override TestResult[] Execute(ITestMethod testMethod)
+ public SkipTestIfNotWindowsAttribute([CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1)
+ : base(callerFilePath, callerLineNumber)
+ {
+ this.CallerFilePath = callerFilePath;
+ this.CallerLineNumber = callerLineNumber;
+ }
+
+ public string CallerFilePath { get; }
+
+ public int CallerLineNumber { get; }
+
+ public override Task ExecuteAsync(ITestMethod testMethod)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- return
- [
+ return Task.FromResult([
new TestResult
{
Outcome = UnitTestOutcome.Inconclusive,
TestFailureException = new AssertInconclusiveException($"Skipped on {RuntimeInformation.OSDescription}."),
},
- ];
+ ]);
}
- return base.Execute(testMethod);
+ return base.ExecuteAsync(testMethod);
}
}
diff --git a/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestOnWindowsAttribute.cs b/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestOnWindowsAttribute.cs
index 5a335a938..c21fc8c3c 100644
--- a/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestOnWindowsAttribute.cs
+++ b/test/Microsoft.ComponentDetection.TestsUtilities/Attributes/SkipTestOnWindowsAttribute.cs
@@ -1,24 +1,36 @@
namespace Microsoft.ComponentDetection.TestsUtilities;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
public sealed class SkipTestOnWindowsAttribute : TestMethodAttribute
{
- public override TestResult[] Execute(ITestMethod testMethod)
+ public SkipTestOnWindowsAttribute([CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1)
+ : base(callerFilePath, callerLineNumber)
+ {
+ this.CallerFilePath = callerFilePath;
+ this.CallerLineNumber = callerLineNumber;
+ }
+
+ public string CallerFilePath { get; }
+
+ public int CallerLineNumber { get; }
+
+ public override Task ExecuteAsync(ITestMethod testMethod)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- return
- [
+ return Task.FromResult([
new TestResult
{
Outcome = UnitTestOutcome.Inconclusive,
TestFailureException = new AssertInconclusiveException("Skipped on Windows."),
},
- ];
+ ]);
}
- return base.Execute(testMethod);
+ return base.ExecuteAsync(testMethod);
}
}
diff --git a/test/Microsoft.ComponentDetection.VerificationTests/AssemblyInfo.cs b/test/Microsoft.ComponentDetection.VerificationTests/AssemblyInfo.cs
new file mode 100644
index 000000000..be2dce49a
--- /dev/null
+++ b/test/Microsoft.ComponentDetection.VerificationTests/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]