diff --git a/test/DemaConsulting.DotnetToolWrapper.Tests/AssemblyInfo.cs b/test/DemaConsulting.DotnetToolWrapper.Tests/AssemblyInfo.cs new file mode 100644 index 0000000..a6e4c28 --- /dev/null +++ b/test/DemaConsulting.DotnetToolWrapper.Tests/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +// Disable test parallelization to avoid race conditions with shared config files +[assembly: DoNotParallelize] diff --git a/test/DemaConsulting.DotnetToolWrapper.Tests/DemaConsulting.DotnetToolWrapper.Tests.csproj b/test/DemaConsulting.DotnetToolWrapper.Tests/DemaConsulting.DotnetToolWrapper.Tests.csproj index e6c8ddc..b08ac85 100644 --- a/test/DemaConsulting.DotnetToolWrapper.Tests/DemaConsulting.DotnetToolWrapper.Tests.csproj +++ b/test/DemaConsulting.DotnetToolWrapper.Tests/DemaConsulting.DotnetToolWrapper.Tests.csproj @@ -13,7 +13,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -21,9 +21,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/DemaConsulting.DotnetToolWrapper.Tests/IntegrationTests.cs b/test/DemaConsulting.DotnetToolWrapper.Tests/IntegrationTests.cs index 728f7c6..92baf8b 100644 --- a/test/DemaConsulting.DotnetToolWrapper.Tests/IntegrationTests.cs +++ b/test/DemaConsulting.DotnetToolWrapper.Tests/IntegrationTests.cs @@ -141,8 +141,8 @@ public void TestMissingConfigFile() // Assert Assert.AreEqual(1, exitCode, "Exit code should be 1 for missing config file"); - Assert.IsTrue(output.Contains("Missing configuration file"), "Output should mention missing config file"); - Assert.IsTrue(output.Contains("DotnetToolWrapper.json"), "Output should mention config file name"); + Assert.Contains("Missing configuration file", output, "Output should mention missing config file"); + Assert.Contains("DotnetToolWrapper.json", output, "Output should mention config file name"); } /// @@ -202,7 +202,7 @@ public void TestArgumentPassing() // Assert Assert.AreEqual(0, exitCode, "Exit code should be 0"); - Assert.IsTrue(output.Contains(testText), $"Output should contain '{testText}'"); + Assert.Contains(testText, output, $"Output should contain '{testText}'"); } /// @@ -228,7 +228,7 @@ public void TestUnsupportedTarget() // Assert Assert.AreEqual(1, exitCode, "Exit code should be 1 for unsupported target"); - Assert.IsTrue(output.Contains("does not support"), "Output should mention unsupported target"); + Assert.Contains("does not support", output, "Output should mention unsupported target"); } /// @@ -255,6 +255,6 @@ public void TestBadConfiguration() // Assert Assert.AreEqual(1, exitCode, "Exit code should be 1 for bad configuration"); - Assert.IsTrue(output.Contains("Bad configuration"), "Output should mention bad configuration"); + Assert.Contains("Bad configuration", output, "Output should mention bad configuration"); } } diff --git a/test/DemaConsulting.DotnetToolWrapper.Tests/ProgramTests.cs b/test/DemaConsulting.DotnetToolWrapper.Tests/ProgramTests.cs index cae0ac5..14d4e3e 100644 --- a/test/DemaConsulting.DotnetToolWrapper.Tests/ProgramTests.cs +++ b/test/DemaConsulting.DotnetToolWrapper.Tests/ProgramTests.cs @@ -51,9 +51,9 @@ public void TestGetTarget() // Assert Assert.IsNotNull(target); - Assert.IsTrue(target.Contains('-'), "Target should contain a hyphen"); + Assert.Contains("-", target, "Target should contain a hyphen"); var parts = target.Split('-'); - Assert.AreEqual(2, parts.Length, "Target should have exactly two parts"); + Assert.HasCount(2, parts, "Target should have exactly two parts"); } }