Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--#if (UseMSTestSdk)-->
<Project Sdk="MSTest.Sdk/4.2.3">
<Project Sdk="MSTest.Sdk/4.5.2">

<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net11.0</TargetFramework>
Expand Down Expand Up @@ -49,7 +49,7 @@
<!--#if (CoverageTool == "coverlet")-->
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<!--#endif-->
<PackageReference Include="MSTest" Version="4.2.3" />
<PackageReference Include="MSTest" Version="4.5.2" />
</ItemGroup>

<!--#if (csharpFeature_ImplicitUsings)-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--#if (UseMSTestSdk)-->
<Project Sdk="MSTest.Sdk/4.2.3">
<Project Sdk="MSTest.Sdk/4.5.2">

<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net11.0</TargetFramework>
Expand Down Expand Up @@ -65,7 +65,7 @@
<!--#if (CoverageTool == "coverlet")-->
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<!--#endif-->
<PackageReference Include="MSTest" Version="4.2.3" />
<PackageReference Include="MSTest" Version="4.5.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--#if (UseMSTestSdk)-->
<Project Sdk="MSTest.Sdk/4.2.3">
<Project Sdk="MSTest.Sdk/4.5.2">

<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net11.0</TargetFramework>
Expand Down Expand Up @@ -45,7 +45,7 @@
<!--#if (CoverageTool == "coverlet")-->
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<!--#endif-->
<PackageReference Include="MSTest" Version="4.2.3" />
<PackageReference Include="MSTest" Version="4.5.2" />
</ItemGroup>

</Project>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--#if (UseMSTestSdk)-->
<Project Sdk="MSTest.Sdk/4.2.3">
<Project Sdk="MSTest.Sdk/4.5.2">

<PropertyGroup>
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net11.0</TargetFramework>
Expand All @@ -9,6 +9,7 @@
<ImplicitUsings Condition="'$(csharpFeature_ImplicitUsings)' == 'true'">enable</ImplicitUsings>
<Nullable Condition="'$(csharpFeature_Nullable)' == 'true'">enable</Nullable>
<EnablePlaywright>true</EnablePlaywright>
<MicrosoftPlaywrightVersion>1.64.1</MicrosoftPlaywrightVersion>
<!--#if (TestRunner == "VSTest")-->
<UseVSTest>true</UseVSTest>
</PropertyGroup>
Expand All @@ -23,6 +24,12 @@
</PropertyGroup>
<!--#endif-->

<!--#if (csharpFeature_ImplicitUsings)-->
<ItemGroup>
<Using Include="System.Text.RegularExpressions" />
</ItemGroup>

<!--#endif-->
</Project>
<!--#else-->
<Project Sdk="Microsoft.NET.Sdk">
Expand All @@ -44,8 +51,8 @@
<!--#if (CoverageTool == "coverlet")-->
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<!--#endif-->
<PackageReference Include="Microsoft.Playwright.MSTest.v4" Version="1.55.0" />
<PackageReference Include="MSTest" Version="4.2.3" />
<PackageReference Include="Microsoft.Playwright.MSTest.v4" Version="1.64.1" />
<PackageReference Include="MSTest" Version="4.5.2" />
</ItemGroup>

<!--#if (csharpFeature_ImplicitUsings)-->
Expand Down
4 changes: 2 additions & 2 deletions test/TestPackages/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"type": "nuget",
"nuget": {
"name": "MSTest",
"version": "4.0.2"
"version": "4.5.2"
}
}
},
Expand Down Expand Up @@ -97,7 +97,7 @@
"type": "nuget",
"nuget": {
"name": "Microsoft.Playwright.MSTest.v4",
"version": "1.55.0"
"version": "1.64.1"
}
}
}
Expand Down
34 changes: 28 additions & 6 deletions test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public void MSTestTemplate_SelectsCurrentTemplateForEverySupportedTargetFramewor
string templateName,
string targetFramework,
string language,
string projectExtension)
string projectExtension,
bool useMSTestSdk)
{
const string projectName = "MSTestProject";
string workingDirectory = CreateTemporaryFolder();
Expand All @@ -83,6 +84,8 @@ public void MSTestTemplate_SelectsCurrentTemplateForEverySupportedTargetFramewor
targetFramework,
"--language",
language,
"--sdk",
useMSTestSdk ? "true" : "false",
"--name",
projectName,
"--output",
Expand All @@ -98,7 +101,21 @@ public void MSTestTemplate_SelectsCurrentTemplateForEverySupportedTargetFramewor
string projectContents = File.ReadAllText(Path.Combine(outputDirectory, $"{projectName}.{projectExtension}"));

projectContents.Should().Contain($"<TargetFramework>{targetFramework}</TargetFramework>");
projectContents.Should().Contain("""<PackageReference Include="MSTest" Version="4.2.3" />""");
projectContents.Should().Contain(useMSTestSdk
? """<Project Sdk="MSTest.Sdk/4.5.2">"""
: """<PackageReference Include="MSTest" Version="4.5.2" />""");

if (templateName == "mstest-playwright")
{
projectContents.Should().Contain(useMSTestSdk
? "<MicrosoftPlaywrightVersion>1.64.1</MicrosoftPlaywrightVersion>"
: """<PackageReference Include="Microsoft.Playwright.MSTest.v4" Version="1.64.1" />""");

if (useMSTestSdk)
{
projectContents.Should().Contain("""<Using Include="System.Text.RegularExpressions" />""");
}
}
}

public static IEnumerable<object[]> MSTestTemplateSelectionData()
Expand All @@ -123,13 +140,13 @@ public static IEnumerable<object[]> MSTestTemplateSelectionData()

foreach (string targetFramework in mstestTargetFrameworks)
{
yield return ["mstest", targetFramework, "C#", "csproj"];
yield return ["mstest", targetFramework, "C#", "csproj", false];
}

// Cover the language-specific template groups at the framework where the
// Microsoft.DotNet.Common.ProjectTemplates.10.0 package can otherwise win.
yield return ["mstest", "net10.0", "F#", "fsproj"];
yield return ["mstest", "net10.0", "VB", "vbproj"];
yield return ["mstest", "net10.0", "F#", "fsproj", false];
yield return ["mstest", "net10.0", "VB", "vbproj", false];

string[] additionalPlaywrightTargetFrameworks =
[
Expand All @@ -142,8 +159,13 @@ public static IEnumerable<object[]> MSTestTemplateSelectionData()

foreach (string targetFramework in mstestTargetFrameworks.Concat(additionalPlaywrightTargetFrameworks))
{
yield return ["mstest-playwright", targetFramework, "C#", "csproj"];
yield return ["mstest-playwright", targetFramework, "C#", "csproj", false];
}

yield return ["mstest", "net11.0", "C#", "csproj", true];
yield return ["mstest", "net11.0", "F#", "fsproj", true];
yield return ["mstest", "net11.0", "VB", "vbproj", true];
yield return ["mstest-playwright", "net11.0", "C#", "csproj", true];
}

#pragma warning disable xUnit1004 // Test methods should not be skipped
Expand Down
Loading