From dd5370fdd27551f835b3e9f235c560338a556b9e Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 12 Aug 2025 08:53:14 +0200 Subject: [PATCH 1/5] Update MSTest templates to v4 --- .../MSTest-CSharp/Company.TestProject1.csproj | 15 ++------------- .../MSTest-FSharp/Company.TestProject1.fsproj | 15 ++------------- .../Company.TestProject1.vbproj | 15 ++------------- .../Company.TestProject1.csproj | 15 ++------------- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj index 7d7c1b6623a5..0ba8a795684d 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj @@ -1,5 +1,5 @@  - + net10.0 @@ -18,11 +18,6 @@ - - true $(ExtensionsProfile) @@ -41,12 +36,6 @@ true Exe - true - - true @@ -54,7 +43,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj index ae0139680fb1..900c3c6dc5b1 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj @@ -1,5 +1,5 @@ - + net10.0 @@ -18,11 +18,6 @@ - - true $(ExtensionsProfile) @@ -46,12 +41,6 @@ true Exe - true - - true @@ -59,7 +48,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj index 7d7c1b6623a5..0ba8a795684d 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj @@ -1,5 +1,5 @@  - + net10.0 @@ -18,11 +18,6 @@ - - true $(ExtensionsProfile) @@ -41,12 +36,6 @@ true Exe - true - - true @@ -54,7 +43,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj index ffeb071f7341..265464011e8c 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj @@ -1,5 +1,5 @@  - + net10.0 @@ -19,11 +19,6 @@ - - true $(ExtensionsProfile) @@ -42,12 +37,6 @@ true Exe - true - - true @@ -56,7 +45,7 @@ - + From 670b1248ca836c24364aaf99656747de3d27d3b2 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Wed, 13 Aug 2025 19:12:30 +0200 Subject: [PATCH 2/5] Update Company.TestProject1.csproj --- .../Playwright-MSTest-CSharp/Company.TestProject1.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj index 265464011e8c..6f807df63d7d 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj @@ -44,7 +44,7 @@ - + From fbe2db6342bc8412db815efe5b9fa7f4d2f8a4d6 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 08:47:33 +0200 Subject: [PATCH 3/5] Add dotnet.config --- .../DotnetNewTestTemplatesTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs index 042f63089f8f..b2f6530a4e7b 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs @@ -193,6 +193,14 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can if (runDotnetTest) { + if (testRunner == "Microsoft.Testing.Platform") + { + File.WriteAllText(Path.Combine(outputDirectory, "dotnet.config"), """ + [dotnet.test.runner] + name = "Microsoft.Testing.Platform" + """); + } + var result = new DotnetTestCommand(_log, false) .WithWorkingDirectory(outputDirectory) .Execute(outputDirectory); From 2d5baa437e542a930326f05cc7a18b64db4359dc Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 16:40:30 +0200 Subject: [PATCH 4/5] Update version and test --- .../content/MSTest-CSharp/Company.TestProject1.csproj | 4 ++-- .../content/MSTest-FSharp/Company.TestProject1.fsproj | 4 ++-- .../content/MSTest-VisualBasic/Company.TestProject1.vbproj | 4 ++-- .../Playwright-MSTest-CSharp/Company.TestProject1.csproj | 4 ++-- .../DotnetNewTestTemplatesTests.cs | 7 +++++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj index 0ba8a795684d..2a1d1376090c 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/Company.TestProject1.csproj @@ -1,5 +1,5 @@  - + net10.0 @@ -43,7 +43,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj index 900c3c6dc5b1..9df357f73ca6 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-FSharp/Company.TestProject1.fsproj @@ -1,5 +1,5 @@ - + net10.0 @@ -48,7 +48,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj index 0ba8a795684d..2a1d1376090c 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-VisualBasic/Company.TestProject1.vbproj @@ -1,5 +1,5 @@  - + net10.0 @@ -43,7 +43,7 @@ - + diff --git a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj index 6f807df63d7d..284731cac198 100644 --- a/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj +++ b/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/Playwright-MSTest-CSharp/Company.TestProject1.csproj @@ -1,5 +1,5 @@  - + net10.0 @@ -45,7 +45,7 @@ - + diff --git a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs index b2f6530a4e7b..6ef7c1a72eec 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs @@ -193,7 +193,8 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can if (runDotnetTest) { - if (testRunner == "Microsoft.Testing.Platform") + var isMTP = testRunner == "Microsoft.Testing.Platform"; + if (isMTP) { File.WriteAllText(Path.Combine(outputDirectory, "dotnet.config"), """ [dotnet.test.runner] @@ -203,7 +204,9 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can var result = new DotnetTestCommand(_log, false) .WithWorkingDirectory(outputDirectory) - .Execute(outputDirectory); +#pragma warning disable SA1010 // Opening square brackets should be spaced correctly - false positive. Current formatting is good. + .Execute(isMTP ? ["--directory", outputDirectory] : [outputDirectory]); +#pragma warning restore SA1010 // Opening square brackets should be spaced correctly result.Should().Pass(); From 99dd9d0b64fdbed48513ef64ddb9570efe3a5ca8 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 15 Aug 2025 17:13:30 +0200 Subject: [PATCH 5/5] Fix test --- test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs index 6ef7c1a72eec..4e66962215d8 100644 --- a/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs +++ b/test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs @@ -211,7 +211,7 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can result.Should().Pass(); result.StdOut.Should().Contain("Passed!"); - result.StdOut.Should().MatchRegex(@"Passed:\s*1"); + result.StdOut.Should().MatchRegex(isMTP ? "succeeded: 1" : @"Passed:\s*1"); } // After executing dotnet new and before cleaning up