diff --git a/Pipelines/asa-pr.yml b/Pipelines/asa-pr.yml
index b07fdcfc..0ad1158d 100644
--- a/Pipelines/asa-pr.yml
+++ b/Pipelines/asa-pr.yml
@@ -22,7 +22,7 @@ resources:
- repository: templates
type: git
name: SecurityEngineering/OSS-Tools-Pipeline-Templates
- ref: refs/tags/v2.0.0
+ ref: refs/tags/v2.0.1
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -52,6 +52,7 @@ extends:
poolImage: MSSecurity-1ES-Windows-2022
poolOs: windows
projectPath: 'Tests/Tests.csproj'
+ dotnetTestArgs: '-- --coverage --report-trx'
- stage: Build
dependsOn: Test
diff --git a/Pipelines/asa-release.yml b/Pipelines/asa-release.yml
index 7d846881..b071b7e1 100644
--- a/Pipelines/asa-release.yml
+++ b/Pipelines/asa-release.yml
@@ -7,7 +7,7 @@ resources:
- repository: templates
type: git
name: Data/OSS-Tools-Pipeline-Templates
- ref: refs/tags/v2.0.0
+ ref: refs/tags/v2.0.1
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -42,6 +42,7 @@ extends:
poolImage: MSSecurity-1ES-Windows-2022
poolOs: windows
projectPath: 'Tests/Tests.csproj'
+ dotnetTestArgs: '-- --coverage --report-trx'
- stage: Build
dependsOn: Test
jobs:
diff --git a/Tests/AsaAnalyzerTests.cs b/Tests/AsaAnalyzerTests.cs
index d76a4f6a..3fe20b1b 100644
--- a/Tests/AsaAnalyzerTests.cs
+++ b/Tests/AsaAnalyzerTests.cs
@@ -12,17 +12,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class AsaAnalyzerTests
{
- public AsaAnalyzerTests()
- {
- }
-
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
[TestMethod]
public void VerifyEmbeddedRulesAreValid()
{
diff --git a/Tests/CollectorTests.cs b/Tests/CollectorTests.cs
index 207d12d4..bef59c05 100644
--- a/Tests/CollectorTests.cs
+++ b/Tests/CollectorTests.cs
@@ -24,13 +24,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class CollectorTests
{
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
///
/// Does not require admin.
///
diff --git a/Tests/ExportTests.cs b/Tests/ExportTests.cs
index 2a51e7e1..4edbedb6 100644
--- a/Tests/ExportTests.cs
+++ b/Tests/ExportTests.cs
@@ -13,13 +13,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class ExportTests
{
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
///
/// Does not require admin.
///
diff --git a/Tests/GlobalSetup.cs b/Tests/GlobalSetup.cs
new file mode 100644
index 00000000..7a116a12
--- /dev/null
+++ b/Tests/GlobalSetup.cs
@@ -0,0 +1,16 @@
+using Microsoft.CST.AttackSurfaceAnalyzer.Utils;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)]
+[assembly: ClassCleanupExecution(ClassCleanupBehavior.EndOfClass)]
+
+[TestClass]
+public static class GlobalSetup
+{
+ [AssemblyInitialize]
+ public static void AssemblySetup(TestContext _)
+ {
+ Logger.Setup(false, true);
+ Strings.Setup();
+ }
+}
\ No newline at end of file
diff --git a/Tests/HydrationTests.cs b/Tests/HydrationTests.cs
index 52838772..ef5ce8aa 100644
--- a/Tests/HydrationTests.cs
+++ b/Tests/HydrationTests.cs
@@ -10,13 +10,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class HydrationTests
{
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
[TestMethod]
public void TestSerializeAndDeserializeCertificateObject()
{
@@ -56,8 +49,8 @@ public void TestSerializeAndDeserializeDriverObject()
var driverObject = new DriverObject(DriverName);
var serialized = JsonUtils.Dehydrate(driverObject);
var rehydrated = JsonUtils.Hydrate(serialized, RESULT_TYPE.DRIVER);
- Assert.IsTrue(serialized == JsonUtils.Dehydrate(rehydrated));
- Assert.IsTrue(rehydrated.Identity == DriverName);
+ Assert.AreEqual(JsonUtils.Dehydrate(rehydrated), serialized);
+ Assert.AreEqual(DriverName, rehydrated.Identity);
}
[TestMethod]
@@ -105,7 +98,7 @@ public void TestSerializeAndDeserializeProcessObject()
{
var po = ProcessObject.FromProcess(Process.GetCurrentProcess());
var serialized = JsonUtils.Dehydrate(po);
- Assert.IsTrue(serialized == JsonUtils.Dehydrate(JsonUtils.Hydrate(serialized, RESULT_TYPE.PROCESS)));
+ Assert.AreEqual(JsonUtils.Dehydrate(JsonUtils.Hydrate(serialized, RESULT_TYPE.PROCESS)), serialized);
}
[TestMethod]
diff --git a/Tests/InMemoryComparatorTests.cs b/Tests/InMemoryComparatorTests.cs
index 93abb82d..27b25483 100644
--- a/Tests/InMemoryComparatorTests.cs
+++ b/Tests/InMemoryComparatorTests.cs
@@ -13,13 +13,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class InMemoryComparatorTests
{
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
[TestMethod]
public void TestAddedInMemory()
{
diff --git a/Tests/RuleFileTests.cs b/Tests/RuleFileTests.cs
index 93ea1325..9af53a4e 100644
--- a/Tests/RuleFileTests.cs
+++ b/Tests/RuleFileTests.cs
@@ -24,13 +24,6 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests
[TestClass]
public class RuleFileTests
{
- [ClassInitialize]
- public static void ClassSetup(TestContext _)
- {
- Logger.Setup(false, true);
- Strings.Setup();
- }
-
///
/// Verify that embedded rules have no issues
///
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index b0b5ac4d..41e6fa8f 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -5,6 +5,10 @@
AsaTests
0.0.0-placeholder
net8.0;net9.0
+ true
+ Exe
+ true
+ true
@@ -13,15 +17,9 @@
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+