Migrate Microsoft.DotNet.PackageInstall.Tests to MSTest.Sdk on MTP - #54900
Merged
Evangelink merged 5 commits intoJun 22, 2026
Merged
Evangelink merged 5 commits into
Evangelink merged 5 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates Microsoft.DotNet.PackageInstall.Tests from xUnit to MSTest.Sdk (Microsoft Testing Platform) as part of the SDK test suite’s ongoing xUnit → MSTest migration, aligning the project with the new MSTest-based test framework introduced in the referenced foundation work.
Changes:
- Converted test project and test sources from xUnit attributes/fixtures/output patterns to
MSTest.Sdk([TestClass],[TestMethod],[DataRow], MSTest conditions,SdkTestlogging/TestContext). - Replaced xUnit collection/class fixtures with MSTest
[ClassInitialize]/[ClassCleanup]and a shared staticLazy<TestToolBuilder>plus[DoNotParallelize]where needed. - Added MSTest-side
InternalsVisibleTomirroring and project-level reference handling to avoid xUnit framework conflicts pulled transitively.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.NET.TestFramework.MSTest/InternalsVisibleToAttributes.cs | Adds mirrored InternalsVisibleTo grants needed by link-shared internals when using the MSTest-flavored framework assembly. |
| test/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj | Switches project to MSTest.Sdk, references Microsoft.NET.TestFramework.MSTest, adds global usings, and removes conflicting legacy test framework reference. |
| test/Microsoft.DotNet.PackageInstall.Tests/UnixFilePermissionsTests.cs | Converts a unit test class from [Fact] to MSTest [TestClass]/[TestMethod]. |
| test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageUninstallerTests.cs | Migrates theory-based Windows-only test to MSTest with OSCondition + DataRow. |
| test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstallerNugetCacheTests.cs | Migrates parameterized Windows-only tests to MSTest attributes/conditions and removes xUnit ctor injection. |
| test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageDownloaderTests.cs | Replaces xUnit fixtures/collection usage with MSTest class init/cleanup and shared tool builder usage; converts all tests to MSTest. |
| test/Microsoft.DotNet.PackageInstall.Tests/ToolConfigurationDeserializerTests.cs | Converts multiple xUnit [Fact] tests to MSTest [TestMethod]. |
| test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs | Removes xUnit collection fixture plumbing and introduces a shared Lazy<TestToolBuilder> instance. |
| test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs | Migrates test class to MSTest and updates exception assertions to MSTest equivalents. |
| test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerExtractTests.cs | Migrates to MSTest and replaces Unix-only gating with OSCondition. |
| test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageDownloaderFactoryTests.cs | Migrates to MSTest attributes and removes xUnit ctor injection. |
| test/Microsoft.DotNet.PackageInstall.Tests/LockFileMatcherTests.cs | Migrates xUnit theories to MSTest [TestMethod] + [DataRow]. |
| test/Microsoft.DotNet.PackageInstall.Tests/LocalToolsResolverCacheTests.cs | Migrates to MSTest and removes xUnit ctor injection. |
| test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs | Migrates end-to-end tests to MSTest, introduces shared tool builder usage + non-parallelization where needed. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink
enabled auto-merge
June 20, 2026 08:38
…ration Keep the xUnit Microsoft.NET.TestFramework in the runtime closure (deps.json) so ComponentMocks can load it at runtime, removing it from the C# compiler references only (via ReferencePathWithRefAssemblies after FindReferenceAssembliesForReferences) instead of ReferenceOutputAssembly=false, which had dropped it from deps.json and caused FileNotFoundException for Microsoft.NET.TestFramework, Version=42.42.42.42 at runtime. Mark ToolPackageInstallToManagedLocationInstaller and ToolPackageUninstallerTests [DoNotParallelize] since they perform real tool installs into the shared NuGet global packages folder and raced under MethodLevel parallelism (IOException: the process cannot access the file ...nupkg because it is being used by another process). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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).
Collection/class fixtures (TestToolBuilder, DotnetEnvironmentTestFixture) become a shared static Lazy / [ClassInitialize] with [DoNotParallelize] to preserve serialization. Includes the InternalsVisibleTo grant this project needs and a target to strip the old xUnit framework dll pulled transitively by ComponentMocks.
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.