Migrate sdk-tasks.Tests, trustedroots.Tests and Microsoft.DotNet.MSBuildSdkResolver.Tests to MSTest.Sdk on MTP#54897
Merged
Evangelink merged 4 commits intoJun 22, 2026
Conversation
…SdkResolver.Tests to MSTest.Sdk on MTP Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates three SDK test projects (sdk-tasks.Tests, trustedroots.Tests, and Microsoft.DotNet.MSBuildSdkResolver.Tests) from xUnit to MSTest.Sdk running on Microsoft Testing Platform (MTP), aligning them with the repo’s ongoing test-suite migration approach.
Changes:
- Converted project files to
Project Sdk="MSTest.Sdk"and switched test framework references toMicrosoft.NET.TestFramework.MSTest. - Updated test sources from xUnit attributes/constructors (
[Fact],[Theory],ITestOutputHelper) to MSTest equivalents ([TestClass],[TestMethod],[DataRow]) and MSTest-style assertions where applicable. - Preserved prior execution semantics where needed (notably disabling parallelization for
Microsoft.DotNet.MSBuildSdkResolver.Testsvia[assembly: DoNotParallelize]plus project-level parallelize scope override).
Show a summary per file
| File | Description |
|---|---|
| test/trustedroots.Tests/trustedroots.Tests.csproj | Switches project to MSTest.Sdk, updates test framework reference, and adds required global Using for Microsoft.NET.TestFramework. |
| test/trustedroots.Tests/GivenTimestampingCtlFile.cs | Adds MSTest discovery/data-driven attributes ([TestClass], [TestMethod], [DataRow]). |
| test/trustedroots.Tests/GivenNuGetPackagingDllAndBundleLayout.cs | Removes xUnit ctor injection pattern and migrates test to MSTest attributes. |
| test/trustedroots.Tests/GivenCodeSigningCtlFile.cs | Adds MSTest discovery/data-driven attributes ([TestClass], [TestMethod], [DataRow]). |
| test/sdk-tasks.Tests/sdk-tasks.Tests.csproj | Switches project to MSTest.Sdk, updates test framework reference, and adds necessary Microsoft.NET.TestFramework.* global usings. |
| test/sdk-tasks.Tests/UpdateRuntimeConfigTests.cs | Migrates xUnit-based tests to MSTest ([TestClass]/[TestMethod]). |
| test/sdk-tasks.Tests/RemoveAssetFromDepsPackagesTests.cs | Migrates xUnit-based tests to MSTest ([TestClass]/[TestMethod]). |
| test/sdk-tasks.Tests/PublishMutationUtilitiesTests.cs | Migrates xUnit-based tests to MSTest ([TestClass]/[TestMethod]). |
| test/sdk-tasks.Tests/GenerateDefaultRuntimeFrameworkVersionTests.cs | Migrates parameterized tests to MSTest ([TestMethod] + [DataRow]). |
| test/sdk-tasks.Tests/FilterItemsByDuplicateHashTests.cs | Migrates tests to MSTest and updates attributes under #if !NETFRAMEWORK. |
| test/sdk-tasks.Tests/DeduplicateAssembliesWithLinksTests.cs | Migrates multiple tests to MSTest attributes under #if !NETFRAMEWORK. |
| test/sdk-tasks.Tests/CopyPreservingRelativeSymlinksTests.cs | Migrates many tests to MSTest attributes under #if !NETFRAMEWORK. |
| test/sdk-tasks.Tests/CalculateTemplateVerionsTests.cs | Migrates tests to MSTest ([TestClass]/[TestMethod]). |
| test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj | Switches project to MSTest.Sdk, updates framework reference, and configures parallelization behavior for process-global-state tests. |
| test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenThatWeWantToParseSemanticVersions.cs | Migrates xUnit theories/facts to MSTest ([TestClass], [TestMethod], [DataRow]). |
| test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenThatIWantToCompareSemanticVersions.cs | Migrates xUnit theories/facts to MSTest ([TestClass], [TestMethod], [DataRow]). |
| test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnMSBuildSdkResolver.cs | Replaces xUnit assembly parallelization configuration with MSTest [assembly: DoNotParallelize] and migrates tests/assertions. |
| test/Microsoft.DotNet.MSBuildSdkResolver.Tests/GivenAnEnvironmentForResolution.cs | Removes xUnit ctor injection and migrates tests to MSTest attributes. |
Copilot's findings
- Files reviewed: 18/18 changed files
- Comments generated: 0
The CreateSourceAndDestDirs helper called CreateTestDirectory() without a name, so [CallerMemberName] resolved to the helper name for every test. All test methods shared one base directory name, and under MSTest MethodLevel parallelism the CI dedup loop's check-then-act raced, picking the same _N directory and colliding on file writes (file in use by another process). Forward the actual test method name so each test gets a unique directory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/ba-g package install test: Message Expected boolean to be False, but found True. |
JeremyKuhne
approved these changes
Jun 22, 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.
Part of the ongoing xUnit -> MSTest.Sdk (MTP) test migration of the .NET SDK test suite, following the same pattern as the other open migration PRs (builds on the foundation merged in #54845).
Covers three small projects. Microsoft.DotNet.MSBuildSdkResolver.Tests disables parallelization ([assembly: DoNotParallelize] + empty MSTestParallelizeScope) to preserve the previous xUnit CollectionBehavior(DisableTestParallelization = true).
Standard transformations: Microsoft.NET.Sdk -> MSTest.Sdk, the TestFramework project reference -> Microsoft.NET.TestFramework.MSTest, [Fact]/[Theory] -> [TestMethod], [InlineData] -> [DataRow], xUnit asserts -> MSTest (including the repo Recommended-mode idiomatic asserts), and ITestOutputHelper constructor injection removed in favour of the base SdkTest Log / TestContext.
Builds clean for the SDK target framework.