Skip to content

Migrate GenAPI and ApiDiff test projects to MSTest.Sdk on MTP#54881

Merged
Evangelink merged 4 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-genapi-apidiff
Jun 22, 2026
Merged

Migrate GenAPI and ApiDiff test projects to MSTest.Sdk on MTP#54881
Evangelink merged 4 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-genapi-apidiff

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates the GenAPI and ApiDiff test projects from xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), following the established repo pattern.

Projects:

  • Microsoft.DotNet.GenAPI.IntegrationTests
  • Microsoft.DotNet.ApiDiff.Tests
  • Microsoft.DotNet.ApiDiff.IntegrationTests

Note: Microsoft.DotNet.GenAPI.Tests is migrated separately in #54726.

Part of the xUnit -> MSTest migration effort. Each project builds cleanly; tests were not run as part of this change.

Migrates the following to MSTest.Sdk (Microsoft.Testing.Platform):
- Microsoft.DotNet.GenAPI.IntegrationTests
- Microsoft.DotNet.ApiDiff.Tests
- Microsoft.DotNet.ApiDiff.IntegrationTests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 08:02
@Evangelink Evangelink requested a review from a team as a code owner June 19, 2026 08:02

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

This PR migrates the GenAPI and ApiDiff test projects from xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), aligning these projects with the repo’s ongoing xUnit → MSTest migration approach.

Changes:

  • Converted GenAPI IntegrationTests and ApiDiff IntegrationTests projects to Sdk="MSTest.Sdk" and updated tests to [TestClass]/[TestMethod].
  • Converted ApiDiff unit tests from [Fact] to [TestMethod] and ported most assertions to MSTest equivalents.
  • Updated test framework project references/usings for the integration test projects to use Microsoft.NET.TestFramework.MSTest.
Show a summary per file
File Description
test/Microsoft.DotNet.GenAPI.IntegrationTests/Tool/GenAPIToolIntegrationTests.cs Converted tool E2E tests to MSTest attributes and removed xUnit constructor injection.
test/Microsoft.DotNet.GenAPI.IntegrationTests/Task/GenAPITaskIntegrationTests.cs Converted task E2E tests to MSTest attributes and removed xUnit primary-constructor pattern.
test/Microsoft.DotNet.GenAPI.IntegrationTests/Microsoft.DotNet.GenAPI.IntegrationTests.csproj Switched project to MSTest.Sdk and referenced Microsoft.NET.TestFramework.MSTest with global usings.
test/Microsoft.DotNet.ApiDiff.Tests/Microsoft.DotNet.ApiDiff.Tests.csproj Switched project to MSTest.Sdk and removed legacy test framework reference.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Base.Tests.cs Adjusted assertions for MSTest and removed an unused using.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Assembly.Tests.cs Converted tests from xUnit [Fact] to MSTest [TestMethod].
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Attribute.Tests.cs Converted tests to MSTest; replaced xUnit Skip with MSTest Ignore.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Class.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Constructor.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Delegate.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Destructor.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Disk.Tests.cs Converted tests to MSTest attributes and ported several assertions.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Enum.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Event.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Field.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Interface.Tests.cs Converted tests to MSTest attributes and replaced Skip with Ignore.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Method.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Namespace.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Operator.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Property.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Record.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Struct.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.Tests/Diff.Type.Tests.cs Converted tests to MSTest attributes.
test/Microsoft.DotNet.ApiDiff.IntegrationTests/Tool/ApiDiffToolIntegrationTests.cs Converted CLI E2E tests to MSTest attributes and removed xUnit constructor injection.
test/Microsoft.DotNet.ApiDiff.IntegrationTests/Microsoft.DotNet.ApiDiff.IntegrationTests.csproj Switched project to MSTest.Sdk and referenced Microsoft.NET.TestFramework.MSTest with global usings.

Copilot's findings

  • Files reviewed: 25/25 changed files
  • Comments generated: 4

Comment thread test/Microsoft.DotNet.ApiDiff.Tests/Diff.Interface.Tests.cs Outdated
Comment thread test/Microsoft.DotNet.ApiDiff.Tests/Diff.Field.Tests.cs Outdated
Comment thread test/Microsoft.DotNet.ApiDiff.Tests/Diff.Field.Tests.cs Outdated
Evangelink and others added 2 commits June 19, 2026 15:55
SymbolFactory.cs is link-compiled into the migrated ApiDiff.Tests and
GenAPI.Tests plus the still-xUnit ApiSymbolExtensions.Tests. xUnit's
Assert.Empty doesn't exist under MSTest, breaking the migrated consumers
(CS0117). Replace the framework-coupled Assert calls with a local
AssertNoDiagnostics helper so the shared file compiles under any framework.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix 'constraing' -> 'constraint' typo in Diff.Interface.Tests Ignore message
- Rename tFieldChange -> FieldChange and tFieldDelete -> FieldDelete to match
  the PascalCase convention used by the other tests in Diff.Field.Tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink merged commit 3b9bd48 into dotnet:main Jun 22, 2026
26 checks passed
@Evangelink Evangelink deleted the evangelink/mstest-genapi-apidiff branch June 22, 2026 16:44
@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