Migrate Microsoft.NET.ToolPack.Tests to MSTest.Sdk on MTP - #54852
Merged
Evangelink merged 7 commits intoJun 23, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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.TeststoMSTest.Sdkand referenceMicrosoft.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
…ia [OSCondition] Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink
enabled auto-merge
June 19, 2026 11:18
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>
Member
Author
|
/ba-g #51530 |
This was referenced Jun 19, 2026
Closed
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
…-toolpack-tests-merge
… 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>
Member
Author
|
/ba-g #54927 |
YuliiaKovalova
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
Microsoft.NET.ToolPack.Testsfrom xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), switching its test-framework reference toMicrosoft.NET.TestFramework.MSTest.Part of the SDK acceptance-test xUnit-->MSTest migration. Depends on #54845 (the
Microsoft.NET.TestFramework.MSTestfoundation) which must merge first. Compiles clean locally for all target frameworks.