Skip to content

Migrate Microsoft.NET.Pack.Tests to MSTest.Sdk on MTP - #54848

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

Evangelink merged 5 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-pack-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates Microsoft.NET.Pack.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
@Evangelink
Evangelink requested a review from a team as a code owner 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.Pack.Tests from xUnit to MSTest.Sdk on Microsoft.Testing.Platform, switching the test-framework reference to Microsoft.NET.TestFramework.MSTest and updating test attributes accordingly.

Changes:

  • Add MSTest condition attributes (e.g., PlatformSpecific, RequiresMSBuildVersion) and an MSTest AspNetSdkTest base class in Microsoft.NET.TestFramework.MSTest.
  • Convert Microsoft.NET.Pack.Tests project file to MSTest.Sdk and reference Microsoft.NET.TestFramework.MSTest.
  • Update pack test sources from [Fact]/[Theory] to [TestMethod] + [DataRow], and replace xUnit ctor injection with MSTest base-class usage.
Show a summary per file
File Description
test/Microsoft.NET.TestFramework.MSTest/ConditionalTestAttributes.cs Introduces MSTest ConditionBaseAttribute-based equivalents of common xUnit conditional test attributes.
test/Microsoft.NET.TestFramework.MSTest/AspNetSdkTest.cs Adds MSTest AspNetSdkTest base class to replace xUnit ctor-injected test output patterns.
test/Microsoft.NET.Pack.Tests/Microsoft.NET.Pack.Tests.csproj Switches the test project to MSTest.Sdk, references Microsoft.NET.TestFramework.MSTest, and adds needed global usings.
test/Microsoft.NET.Pack.Tests/SolutionPackTests.cs Converts test class/method annotations from xUnit to MSTest.
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackASimpleLibrary.cs Converts xUnit test + MSBuild-version gating to MSTest equivalents.
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackAProjectTool.cs Converts xUnit tests to MSTest.
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackANetFrameworkLibrary.cs Converts Windows-only xUnit tests to MSTest PlatformSpecific(TestPlatforms.Windows).
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackAHelloWorldProject.cs Converts facts/theories to MSTest test methods and data rows; updates assertions to MSTest Assert.*.
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACrossTargetedLibrary.cs Converts xUnit MSBuild-version gating to MSTest equivalent.
test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackACppCliProject.cs Converts xUnit skip/trait usage to MSTest [Ignore] + conditional attribute usage.
test/Microsoft.NET.Pack.Tests/GivenThatThereAreImplicitPackageReferences.cs Converts xUnit facts/theories to MSTest methods and data rows, including OS-gated tests.

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 3

Evangelink and others added 2 commits June 18, 2026 16:01
…ia [OSCondition]

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

Microsoft.DotNet.Cli.Utils.Tests is an MSTest.Sdk project, but
TransientSdkResolutionErrorDetectorTests.cs was added 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 a3c6e7b 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.

4 participants