Skip to content

Migrate Microsoft.NET.ToolPack.Tests to MSTest.Sdk on MTP - #54852

Merged
Evangelink merged 7 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-toolpack-tests
Jun 23, 2026
Merged

Evangelink merged 7 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-toolpack-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates Microsoft.NET.ToolPack.Tests from xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), switching its test-framework reference to Microsoft.NET.TestFramework.MSTest.

Part of the SDK acceptance-test xUnit-->MSTest migration. Depends on #54845 (the Microsoft.NET.TestFramework.MSTest foundation) which must merge first. Compiles clean locally for all target frameworks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates Microsoft.NET.ToolPack.Tests from xUnit to MSTest.Sdk on Microsoft.Testing.Platform by switching the project SDK and converting test attributes/base classes to the MSTest equivalents, while also bringing in MSTest-specific test framework helpers needed by migrated acceptance tests.

Changes:

  • Switch Microsoft.NET.ToolPack.Tests to MSTest.Sdk and reference Microsoft.NET.TestFramework.MSTest.
  • Convert tests from [Fact]/[Theory] to [TestMethod] + [DataRow] and add [TestClass] declarations.
  • Add MSTest-specific framework pieces (e.g., conditional test attributes + MSTest-flavored AspNetSdkTest) to support ongoing test migrations.
Show a summary per file
File Description
test/Microsoft.NET.ToolPack.Tests/Microsoft.NET.ToolPack.Tests.csproj Moves the test project to MSTest.Sdk and swaps to the MSTest test framework project reference.
test/Microsoft.NET.ToolPack.Tests/GlobalUsings.cs Adds shared global usings for the test framework helper namespaces.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToTestPackAToolProject.cs Converts the test class/method attributes to MSTest.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolWithCustomNuspec.cs Converts [Fact] tests to MSTest methods.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolTargetingNonSupportedTFM.cs Converts theory + Windows-only gating to MSTest method/data rows and platform condition.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolSelfContainedProject.cs Converts test attributes to MSTest (and updates commented-out test annotation).
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs Replaces xUnit fixture usage with MSTest class init/cleanup + shared fixture pattern.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithP2PReference.cs Converts [Fact] tests to MSTest methods.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithGeneratePackageOnBuild.cs Converts facts/theory skip to MSTest [TestMethod] + [Ignore] + data rows.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithExplicitConfig.cs Converts [Fact] tests to MSTest methods.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithComplexNugetDependency.cs Converts theory to MSTest method with data rows.
test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProject.cs Converts facts/theories to MSTest methods with data rows.
test/Microsoft.NET.TestFramework.MSTest/ConditionalTestAttributes.cs Adds MSTest condition attributes (platform/MSBuild/framework gating) for migrated tests.
test/Microsoft.NET.TestFramework.MSTest/AspNetSdkTest.cs Adds the MSTest-flavored AspNetSdkTest base class for migrated ASP.NET SDK tests.

Copilot's findings

  • Files reviewed: 14/14 changed files
  • Comments generated: 1

Evangelink and others added 2 commits June 18, 2026 16:12
@Evangelink
Evangelink enabled auto-merge June 19, 2026 11:18
Evangelink and others added 2 commits June 19, 2026 14:19
Under MSTest.Sdk method-level parallelization, multiple [DataRow] cases of
the same test method shared one test asset directory (id was keyed only on
the method name + TFM), causing 'consoledemo.csproj is being used by another
process' IOExceptions. Include multiTarget and packageType in the id so each
row gets a distinct directory, and sanitize unsafe chars for the dir/binlog.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g #51530

@Evangelink

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Evangelink and others added 2 commits June 22, 2026 18:42
… build

Microsoft.DotNet.Cli.Utils.Tests is an MSTest.Sdk project, but
TransientSdkResolutionErrorDetectorTests.cs was added (via the TestCommand
transient-retry work) still using xUnit [Fact], so the test build fails with
CS0246 'Fact'/'FactAttribute' on main and on every PR built against it
(including this one). Add [TestClass] and convert the five [Fact] methods to
[TestMethod]; MSTest.Sdk provides the MSTest namespace and FluentAssertions as
implicit global usings, so no using changes are needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g #54927

@Evangelink
Evangelink merged commit 35de7e6 into dotnet:main Jun 23, 2026
23 of 25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants