[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D24SR32853JQPKAMCETA7J":3,"skill-same:01M7D24SR32853JQPKAMCETA7J":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7D24SR32853JQPKAMCETA7J","migrate-xunit-to-mstest",null,"Convert .NET tests from xUnit.net v2\u002Fv3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact\u002FTheory\u002FInlineData\u002FMemberData, assertions, IClassFixture\u002FICollectionFixture, ITestOutputHelper, TestContext cancellation, traits\u002FOwner, skips, timeouts, and xUnit parallelization. Also use when a \"convert xUnit to MSTest\" request may already be migrated: inspect and report the no-op. Do not use for xUnit v2-to-v3, MSTest upgrades, NUnit\u002FTUnit conversion, or runner-only VSTest-to-MTP migration.","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F13-Testing-QA\u002Fmigrate-xunit-to-mstest\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: migrate-xunit-to-mstest\ndescription: >\n  Convert .NET tests from xUnit.net v2\u002Fv3 to MSTest v4 while preserving VSTest\n  or MTP. Use for replacing xunit packages, Fact\u002FTheory\u002FInlineData\u002FMemberData,\n  assertions, IClassFixture\u002FICollectionFixture, ITestOutputHelper, TestContext\n  cancellation, traits\u002FOwner, skips, timeouts, and xUnit parallelization. Also\n  use when a \"convert xUnit to MSTest\" request may already be migrated: inspect\n  and report the no-op. Do not use for xUnit v2-to-v3, MSTest upgrades,\n  NUnit\u002FTUnit conversion, or runner-only VSTest-to-MTP migration.\nlicense: MIT\n---\n\n# xUnit -> MSTest Migration\n\nConvert xUnit.net v2 or v3 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same tests, and preserves pass\u002Ffail results and execution semantics.\n\n## Scope\n\nUse this skill only when the project contains xUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no xUnit tests, report that no framework migration is needed and make no changes.\n\nDo not combine this framework conversion with a target-framework upgrade or VSTest\u002FMTP migration. Complete and verify one migration before starting another.\n\n## Workspace Contract\n\n- Continue after skill activation. Search the current working directory for the\n  staged project and source; never look for user files under this skill's base\n  directory.\n- Open the literal paths returned by glob\u002Fsearch. If one reader or patch tool\n  rejects a path that was just found, retry with another available tool. Do not\n  ask the user for a path until current-workspace discovery is exhausted.\n- Classify by the requested deliverable: \"convert this project\" means edit,\n  build, and test; \"give me a plan\" or \"how would I convert it?\" means answer.\n  Do not replace execution with \"please provide the files\" when files are present.\n- The final response must state the source xUnit version, preserved runner,\n  changed files, each high-risk semantic mapping applied, and actual test\n  counts. Assertions about fixture lifetime, Owner mapping, cancellation, or\n  parallelization must be visible in the resulting source, not only prose.\n\n## Response Mode\n\n- **Full migration request:** inspect the project, make the edits, build, and run tests. Do not stop after giving a plan.\n- **Focused compile error or API question:** inspect the relevant code and apply only that mapping. Do not narrate the entire workflow.\n- **Unsupported target framework:** stop before changing packages. MSTest v4 requires .NET 8+ or .NET Framework 4.6.2+ for test applications; offer a separately approved TFM upgrade or MSTest v3 as the intermediate target.\n\n## Decisions That Change the Result\n\nApply these before the mechanical mapping:\n\n| Detected state | Required action |\n|---|---|\n| No xUnit package, namespace, attribute, or fixture remains | Stop. Make no file changes, report that migration is unnecessary, and run the existing `dotnet test` command once to prove the already-MSTest project is healthy. |\n| Source uses VSTest | Keep the existing VSTest property\u002Fconfiguration. Prefer retaining and updating a source project's explicit `Microsoft.NET.Test.Sdk` pin; a repository that intentionally relies on the MSTest metapackage's transitive dependency may keep that convention. Do not introduce MTP properties. |\n| Source uses MTP | Replace xUnit-specific MTP selection with MSTest MTP configuration. Prefer `MSTest.Sdk`; with the metapackage, set `EnableMSTestRunner=true` and `OutputType=Exe`. Preserve native-versus-bridged command integration, and do not add `\u003CUseVSTest>true\u003C\u002FUseVSTest>` or other VSTest-only configuration. |\n| Source relies on xUnit's default parallelization | Add `[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.ClassLevel)]` to a compiled `.cs` file when the current project has at least two independently runnable test classes. In a one-class project with no explicit parallel setting, omit it because class-level concurrency is not observable. Translate explicit `CollectionBehavior` or `xunit.runner.json` settings regardless of current class count. Before reporting completion, read the changed file back and name it in the result. |\n\nFor detailed mappings and examples, search [`references\u002Fmapping-cheatsheet.md`](references\u002Fmapping-cheatsheet.md) for constructs actually present in the project and read only the matching sections. Do not load or reproduce the whole reference.\n\n## Fast Path\n\nFor a routine project migration, converge in four phases: one batched discovery read\u002Fsearch, one edit pass, one `dotnet test`, and one concise result. Do not:\n\n- list a directory and then reread the same files through another tool\n- copy project files into the loaded skill or its `references\u002F` directory; those files are read-only guidance, not an editing workspace\n- try `dotnet test --no-restore` unless restore is already known to be current\n- run separate restore, build, and test commands when `dotnet test` is sufficient\n- rerun a passing test command or inspect unchanged files for confirmation\n\nUse an existing CI\u002Ftest result as the parity baseline when available. Run a new pre-edit baseline only when counts are unavailable and the migration contains data-driven tests, fixtures, skips, custom extensions, shared state, or other behavior whose parity cannot be established from source alone.\n\n## Workflow\n\n### 1. Establish the baseline\n\n1. In one discovery pass, batch-read the test projects plus `Directory.Build.props`, `Directory.Packages.props`, `global.json`, and runner configuration, and search the source for the high-risk constructs below.\n2. State the detected source version:\n   - `xunit` 2.x and related packages -> xUnit v2\n   - `xunit.v3` or `xunit.v3.*` -> xUnit v3\n3. Identify VSTest or MTP from the project and repository configuration. Use `platform-detection` only when the platform is ambiguous, and preserve the detected platform.\n4. Record the target frameworks and stop if MSTest v4 does not support them.\n5. If the Fast Path requires a new baseline, run the existing test command once and record discovered, passed, failed, and skipped counts.\n6. Inventory high-risk constructs before editing:\n   - `IClassFixture`, `ICollectionFixture`, `CollectionDefinition`, custom `FactAttribute`\u002F`TheoryAttribute`\u002F`DataAttribute`\n   - `Assert.Throws`, `ThrowsAny`, `IsType`, `Record.Exception`, event assertions\n   - `ITestOutputHelper`, `TestContext.Current`, `IAsyncLifetime`\n   - `CollectionBehavior`, `xunit.runner.json`, shared static or external state\n\n### 2. Replace packages without switching runners\n\nRemove xUnit packages from project files and central package files. This includes `xunit*`, `xunit.v3.*`, `xunit.runner.visualstudio`, `YTest.MTP.XUnit2`, and xUnit-specific companion packages that are being replaced.\n\nDefault to the MSTest v4 metapackage for an incremental conversion:\n\n```xml\n\u003C!-- Example pin: replace with the exact stable v4 version resolved from the configured package source. -->\n\u003CPackageReference Include=\"MSTest\" Version=\"4.1.0\" \u002F>\n```\n\nThe metapackage includes `Microsoft.NET.Test.Sdk`, `MSTest.TestAdapter`, `MSTest.TestFramework`, and `MSTest.Analyzers`. When preserving VSTest, prefer retaining a source project's explicit `Microsoft.NET.Test.Sdk` pin and update it to a version compatible with the chosen MSTest version; this keeps runner\u002Fversion compatibility reviewable. A repository that intentionally relies on the metapackage's transitive dependency may preserve that convention instead. For the example pin above, MSTest 4.1.0 requires Microsoft.NET.Test.Sdk 18.0.1+; incompatible older pins can cause `NU1605`.\n\nWhen preserving MTP, do not carry xUnit's `UseMicrosoftTestingPlatformRunner` property into the MSTest project. Prefer `MSTest.Sdk` at the resolved version. If repository conventions require the metapackage route, set `\u003CEnableMSTestRunner>true\u003C\u002FEnableMSTestRunner>` and `\u003COutputType>Exe\u003C\u002FOutputType>`. Retain `TestingPlatformDotnetTestSupport=true` only for repositories that continue to invoke MTP applications through VSTest command mode; native .NET 10+ MTP mode does not require it. When preserving VSTest with `MSTest.Sdk`, set `\u003CUseVSTest>true\u003C\u002FUseVSTest>`.\n\nDo not change `TargetFramework`. Remove `xunit.runner.json` only after porting its relevant settings.\n\n### 3. Perform the mechanical conversion\n\nApply the common rewrites first:\n\n| xUnit | MSTest |\n|---|---|\n| no class attribute | `[TestClass]` |\n| `[Fact]` | `[TestMethod]` |\n| `[Theory]` + `[InlineData]` | `[TestMethod]` + `[DataRow]` |\n| `[MemberData]` | `[DynamicData]` |\n| `[Fact(Skip = \"...\")]` | `[TestMethod]` + `[Ignore(\"...\")]` |\n| `[Trait(\"Category\", value)]` | `[TestCategory(value)]` |\n| `[Trait(\"Owner\", value)]` | `[Owner(value)]` |\n| other `[Trait(key, value)]` | `[TestProperty(key, value)]` |\n| `Assert.Equal` \u002F `NotEqual` | `Assert.AreEqual` \u002F `AreNotEqual` |\n| `Assert.True` \u002F `False` | `Assert.IsTrue` \u002F `IsFalse` |\n| `Assert.Null` \u002F `NotNull` | `Assert.IsNull` \u002F `IsNotNull` |\n\nRemove `using Xunit;` and `using Xunit.Abstractions;`. Add `using Microsoft.VisualStudio.TestTools.UnitTesting;` for the metapackage option; `MSTest.Sdk` supplies it as an implicit global using.\n\nPreserve existing class inheritance. Do not mechanically seal classes.\n\n### 4. Resolve semantic mappings\n\nLoad the mapping cheatsheet for every high-risk construct found in Step 1. These rules are mandatory:\n\n- xUnit `Assert.Throws\u003CT>` is exact-type and maps to MSTest `Assert.ThrowsExactly\u003CT>`.\n- xUnit `Assert.ThrowsAny\u003CT>` permits derived types and maps to MSTest `Assert.Throws\u003CT>`.\n- xUnit `Assert.IsType\u003CT>` is exact-type and maps to the generic `Assert.IsExactInstanceOfType\u003CT>`; `Assert.IsAssignableFrom\u003CT>` maps to the generic `Assert.IsInstanceOfType\u003CT>`. When the xUnit assertion's typed return value is assigned, preserve that assignment and use the generic MSTest overload rather than a non-generic `Type` overload.\n- xUnit `Assert.Equal` on sequences compares elements. Use `Assert.AreSequenceEqual` on MSTest 4.3+ or `CollectionAssert.AreEqual` with materialized lists on earlier v4; never replace sequence equality with reference-based `Assert.AreEqual`.\n- `[Ignore]` and `[Timeout]` are modifiers; keep `[TestMethod]` so the test is discovered.\n- `[DataRow]` values must exactly match parameter types.\n- `TestContext.Current.CancellationToken` maps to an injected MSTest `TestContext.CancellationToken`; never replace it with `CancellationToken.None` or a new `CancellationTokenSource`.\n- `Owner` is a reserved VSTest property. Map `[Trait(\"Owner\", value)]` to `[Owner(value)]`, not `[TestProperty(\"Owner\", value)]`.\n- Assertions with no MSTest equivalent (`Assert.Collection`, `Assert.All`, `Assert.Equivalent`, `Record.Exception`, event assertions) require an explicit manual rewrite. Never delete an assertion without replacing its verification.\n\nApply the mechanical and semantic rewrites in one edit pass when the inventory makes the required mappings clear. Do not run an intermediate build by default; use compiler errors from final verification to drive only unresolved conversions.\n\n### 5. Preserve lifecycle, fixture scope, and parallelization\n\n- Keep constructor setup and `IDisposable`\u002F`IAsyncDisposable` when valid. Map `IAsyncLifetime` to `[TestInitialize]`\u002F`[TestCleanup]`.\n- `IClassFixture\u003CT>` means one fixture instance per test class, shared by all methods in that class. Map it to a static `T` field created once by a static `[ClassInitialize]` method that accepts `TestContext`, and dispose it once from static `[ClassCleanup]`. Never use `[TestInitialize]`\u002F`[TestCleanup]` for this mapping because that creates one fixture per test method.\n- For `ICollectionFixture\u003CT>`, preserve both sharing and serialization. Prefer a static `Lazy\u003CT>` helper used by each member class; add `[DoNotParallelize]` only when the source collection disabled parallelization. Use assembly initialization only when the fixture is genuinely assembly-wide.\n- Replace `ITestOutputHelper` with constructor-injected or property-based MSTest `TestContext`, and replace each `_output.WriteLine(...)` call with the corresponding `TestContext.WriteLine(...)`. In the final result, name both the `TestContext` injection\u002Fproperty and the `WriteLine` mapping explicitly; \"migrated output\" is not enough to demonstrate parity.\n\nxUnit runs classes in parallel by default; MSTest runs them serially. When the current project has two or more independently runnable test classes, preserve that effective behavior with:\n\n```csharp\n[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.ClassLevel)]\n```\n\nFor a one-class project with no explicit xUnit parallel setting, do not add an assembly policy: there is no class-level concurrency to preserve. Always translate explicit `CollectionBehavior` or `xunit.runner.json` settings. Never use `ExecutionScope.MethodLevel` to emulate xUnit. Before applying a fixture-scope or parallelization decision, state what the source shared or serialized and how the target preserves it.\n\n### 6. Verify parity\n\n1. Run tests once with the same platform, filter, and configuration used for the baseline. `dotnet test` builds by default; run a separate build only when needed to isolate a compilation failure.\n2. Compare discovered, passed, failed, and skipped counts.\n3. Investigate every difference before declaring completion:\n   - missing cases -> discovery attributes, `DynamicData`, or `DataRow` literal types\n   - changed exception behavior -> exact-vs-derived assertion mapping\n   - shared-state failures or large duration changes -> fixture scope and parallelization\n   - silently skipped tests -> missing `[TestMethod]` or incorrect runtime-skip conversion\n4. Confirm no xUnit package, namespace, attribute, runner configuration, or fixture interface remains unless explicitly documented for manual follow-up.\n5. After the final passing test, read back each changed file that implements a high-risk mapping, plus any runner or parallelization configuration. In the result, name the file and the exact target APIs that implement its lifecycle, data, skip, output, assertion, fixture-scope, or parallelization behavior. Preserve type arguments and member names such as `[ClassInitialize]`, `TestContext.WriteLine`, and `Assert.IsExactInstanceOfType\u003CT>`; generic claims such as \"converted attributes\" or \"migrated output\" are not evidence of parity.\n\nKeep the final response concise and outcome-focused:\n\n- **Changed:** name the files and exact high-risk mappings applied.\n- **Verified:** give the final test command and discovered\u002Fpassed\u002Ffailed\u002Fskipped counts.\n- **Preserved:** state the unchanged target framework and test platform, plus any fixture or parallelization scope decision.\n- **Remaining:** identify manual follow-up, or say none.\n\n## Completion Criteria\n\n- Current xUnit version and test platform were identified\n- xUnit packages and source constructs were converted\n- Target framework and test platform stayed unchanged\n- Fixture scope and effective parallelization decisions are explicit, including justified omission when concurrency is not observable\n- Build succeeds\n- Test discovery and result counts match the baseline\n- Any unsupported custom extension point is called out rather than approximated\n\n## Follow-up\n\nRun `migrate-vstest-to-mtp` separately if the user also wants MTP. Use `writing-mstest-tests` only after parity is established to polish the converted MSTest code.\n","# xUnit -> MSTest Migration\n\nConvert xUnit.net v2 or v3 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same tests, and preserves pass\u002Ffail results and execution semantics.\n\n## Scope\n\nUse this skill only when the project contains xUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no xUnit tests, report that no framework migration is needed and make no changes.\n\nDo not combine this framework conversion with a target-framework upgrade or VSTest\u002FMTP migration. Complete and verify one migration before starting another.\n\n## Workspace Contract\n\n- Continue after skill activation. Search the current working directory for the\n  staged project and source; never look for user files under this skill's base\n  directory.\n- Open the literal paths returned by glob\u002Fsearch. If one reader or patch tool\n  rejects a path that was just found, retry with another available tool. Do not\n  ask the user for a path until current-workspace discovery is exhausted.\n- Classify by the requested deliverable: \"convert this project\" means edit,\n  build, and test; \"give me a plan\" or \"how would I convert it?\" means answer.\n  Do not replace execution with \"please provide the files\" when files are present.\n- The final response must state the source xUnit version, preserved runner,\n  changed files, each high-risk semantic mapping applied, and actual test\n  counts. Assertions about fixture lifetime, Owner mapping, cancellation, or\n  parallelization must be visible in the resulting source, not only prose.\n\n## Response Mode\n\n- **Full migration request:** inspect the project, make the edits, build, and run tests. Do not stop after giving a plan.\n- **Focused compile error or API question:** inspect the relevant code and apply only that mapping. Do not narrate the entire workflow.\n- **Unsupported target framework:** stop before changing packages. MSTest v4 requires .NET 8+ or .NET Framework 4.6.2+ for test applications; offer a separately approved TFM upgrade or MSTest v3 as the intermediate target.\n\n## Decisions That Change the Result\n\nApply these before the mechanical mapping:\n\n| Detected state | Required action |\n|---|---|\n| No xUnit package, namespace, attribute, or fixture remains | Stop. Make no file changes, report that migration is unnecessary, and run the existing `dotnet test` command once to prove the already-MSTest project is healthy. |\n| Source uses VSTest | Keep the existing VSTest property\u002Fconfiguration. Prefer retaining and updating a source project's explicit `Microsoft.NET.Test.Sdk` pin; a repository that intentionally relies on the MSTest metapackage's transitive dependency may keep that convention. Do not introduce MTP properties. |\n| Source uses MTP | Replace xUnit-specific MTP selection with MSTest MTP configuration. Prefer `MSTest.Sdk`; with the metapackage, set `EnableMSTestRunner=true` and `OutputType=Exe`. Preserve native-versus-bridged command integration, and do not add `\u003CUseVSTest>true\u003C\u002FUseVSTest>` or other VSTest-only configuration. |\n| Source relies on xUnit's default parallelization | Add `[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.ClassLevel)]` to a compiled `.cs` file when the current project has at least two independently runnable test classes. In a one-class project with no explicit parallel setting, omit it because class-level concurrency is not observable. Translate explicit `CollectionBehavior` or `xunit.runner.json` settings regardless of current class count. Before reporting completion, read the changed file back and name it in the result. |\n\nFor detailed mappings and examples, search [`references\u002Fmapping-cheatsheet.md`](references\u002Fmapping-cheatsheet.md) for constructs actually present in the project and read only the matching sections. Do not load or reproduce the whole reference.\n\n## Fast Path\n\nFor a routine project migration, converge in four phases: one batched discovery read\u002Fsearch, one edit pass, one `dotnet test`, and one concise result. Do not:\n\n- list a directory and then reread the same files through another tool\n- copy project files into the loaded skill or its `references\u002F` directory; those files are read-only guidance, not an editing workspace\n- try `dotnet test --no-restore` unless restore is already known to be current\n- run separate restore, build, and test commands when `dotnet test` is sufficient\n- rerun a passing test command or inspect unchanged files for confirmation\n\nUse an existing CI\u002Ftest result as the parity baseline when available. Run a new pre-edit baseline only when counts are unavailable and the migration contains data-driven tests, fixtures, skips, custom extensions, shared state, or other behavior whose parity cannot be established from source alone.\n\n## Workflow\n\n### 1. Establish the baseline\n\n1. In one discovery pass, batch-read the test projects plus `Directory.Build.props`, `Directory.Packages.props`, `global.json`, and runner configuration, and search the source for the high-risk constructs below.\n2. State the detected source version:\n   - `xunit` 2.x and related packages -> xUnit v2\n   - `xunit.v3` or `xunit.v3.*` -> xUnit v3\n3. Identify VSTest or MTP from the project and repository configuration. Use `platform-detection` only when the platform is ambiguous, and preserve the detected platform.\n4. Record the target frameworks and stop if MSTest v4 does not support them.\n5. If the Fast Path requires a new baseline, run the existing test command once and record discovered, passed, failed, and skipped counts.\n6. Inventory high-risk constructs before editing:\n   - `IClassFixture`, `ICollectionFixture`, `CollectionDefinition`, custom `FactAttribute`\u002F`TheoryAttribute`\u002F`DataAttribute`\n   - `Assert.Throws`, `ThrowsAny`, `IsType`, `Record.Exception`, event assertions\n   - `ITestOutputHelper`, `TestContext.Current`, `IAsyncLifetime`\n   - `CollectionBehavior`, `xunit.runner.json`, shared static or external state\n\n### 2. Replace packages without switching runners\n\nRemove xUnit packages from project files and central package files. This includes `xunit*`, `xunit.v3.*`, `xunit.runner.visualstudio`, `YTest.MTP.XUnit2`, and xUnit-specific companion packages that are being replaced.\n\nDefault to the MSTest v4 metapackage for an incremental conversion:\n\n```xml\n\u003C!-- Example pin: replace with the exact stable v4 version resolved from the configured package source. -->\n\u003CPackageReference Include=\"MSTest\" Version=\"4.1.0\" \u002F>\n```\n\nThe metapackage includes `Microsoft.NET.Test.Sdk`, `MSTest.TestAdapter`, `MSTest.TestFramework`, and `MSTest.Analyzers`. When preserving VSTest, prefer retaining a source project's explicit `Microsoft.NET.Test.Sdk` pin and update it to a version compatible with the chosen MSTest version; this keeps runner\u002Fversion compatibility reviewable. A repository that intentionally relies on the metapackage's transitive dependency may preserve that convention instead. For the example pin above, MSTest 4.1.0 requires Microsoft.NET.Test.Sdk 18.0.1+; incompatible older pins can cause `NU1605`.\n\nWhen preserving MTP, do not carry xUnit's `UseMicrosoftTestingPlatformRunner` property into the MSTest project. Prefer `MSTest.Sdk` at the resolved version. If repository conventions require the metapackage route, set `\u003CEnableMSTestRunner>true\u003C\u002FEnableMSTestRunner>` and `\u003COutputType>Exe\u003C\u002FOutputType>`. Retain `TestingPlatformDotnetTestSupport=true` only for repositories that continue to invoke MTP applications through VSTest command mode; native .NET 10+ MTP mode does not require it. When preserving VSTest with `MSTest.Sdk`, set `\u003CUseVSTest>true\u003C\u002FUseVSTest>`.\n\nDo not change `TargetFramework`. Remove `xunit.runner.json` only after porting its relevant settings.\n\n### 3. Perform the mechanical conversion\n\nApply the common rewrites first:\n\n| xUnit | MSTest |\n|---|---|\n| no class attribute | `[TestClass]` |\n| `[Fact]` | `[TestMethod]` |\n| `[Theory]` + `[InlineData]` | `[TestMethod]` + `[DataRow]` |\n| `[MemberData]` | `[DynamicData]` |\n| `[Fact(Skip = \"...\")]` | `[TestMethod]` + `[Ignore(\"...\")]` |\n| `[Trait(\"Category\", value)]` | `[TestCategory(value)]` |\n| `[Trait(\"Owner\", value)]` | `[Owner(value)]` |\n| other `[Trait(key, value)]` | `[TestProperty(key, value)]` |\n| `Assert.Equal` \u002F `NotEqual` | `Assert.AreEqual` \u002F `AreNotEqual` |\n| `Assert.True` \u002F `False` | `Assert.IsTrue` \u002F `IsFalse` |\n| `Assert.Null` \u002F `NotNull` | `Assert.IsNull` \u002F `IsNotNull` |\n\nRemove `using Xunit;` and `using Xunit.Abstractions;`. Add `using Microsoft.VisualStudio.TestTools.UnitTesting;` for the metapackage option; `MSTest.Sdk` supplies it as an implicit global using.\n\nPreserve existing class inheritance. Do not mechanically seal classes.\n\n### 4. Resolve semantic mappings\n\nLoad the mapping cheatsheet for every high-risk construct found in Step 1. These rules are mandatory:\n\n- xUnit `Assert.Throws\u003CT>` is exact-type and maps to MSTest `Assert.ThrowsExactly\u003CT>`.\n- xUnit `Assert.ThrowsAny\u003CT>` permits derived types and maps to MSTest `Assert.Throws\u003CT>`.\n- xUnit `Assert.IsType\u003CT>` is exact-type and maps to the generic `Assert.IsExactInstanceOfType\u003CT>`; `Assert.IsAssignableFrom\u003CT>` maps to the generic `Assert.IsInstanceOfType\u003CT>`. When the xUnit assertion's typed return value is assigned, preserve that assignment and use the generic MSTest overload rather than a non-generic `Type` overload.\n- xUnit `Assert.Equal` on sequences compares elements. Use `Assert.AreSequenceEqual` on MSTest 4.3+ or `CollectionAssert.AreEqual` with materialized lists on earlier v4; never replace sequence equality with reference-based `Assert.AreEqual`.\n- `[Ignore]` and `[Timeout]` are modifiers; keep `[TestMethod]` so the test is discovered.\n- `[DataRow]` values must exactly match parameter types.\n- `TestContext.Current.CancellationToken` maps to an injected MSTest `TestContext.CancellationToken`; never replace it with `CancellationToken.None` or a new `CancellationTokenSource`.\n- `Owner` is a reserved VSTest property. Map `[Trait(\"Owner\", value)]` to `[Owner(value)]`, not `[TestProperty(\"Owner\", value)]`.\n- Assertions with no MSTest equivalent (`Assert.Collection`, `Assert.All`, `Assert.Equivalent`, `Record.Exception`, event assertions) require an explicit manual rewrite. Never delete an assertion without replacing its verification.\n\nApply the mechanical and semantic rewrites in one edit pass when the inventory makes the required mappings clear. Do not run an intermediate build by default; use compiler errors from final verification to drive only unresolved conversions.\n\n### 5. Preserve lifecycle, fixture scope, and parallelization\n\n- Keep constructor setup and `IDisposable`\u002F`IAsyncDisposable` when valid. Map `IAsyncLifetime` to `[TestInitialize]`\u002F`[TestCleanup]`.\n- `IClassFixture\u003CT>` means one fixture instance per test class, shared by all methods in that class. Map it to a static `T` field created once by a static `[ClassInitialize]` method that accepts `TestContext`, and dispose it once from static `[ClassCleanup]`. Never use `[TestInitialize]`\u002F`[TestCleanup]` for this mapping because that creates one fixture per test method.\n- For `ICollectionFixture\u003CT>`, preserve both sharing and serialization. Prefer a static `Lazy\u003CT>` helper used by each member class; add `[DoNotParallelize]` only when the source collection disabled parallelization. Use assembly initialization only when the fixture is genuinely assembly-wide.\n- Replace `ITestOutputHelper` with constructor-injected or property-based MSTest `TestContext`, and replace each `_output.WriteLine(...)` call with the corresponding `TestContext.WriteLine(...)`. In the final result, name both the `TestContext` injection\u002Fproperty and the `WriteLine` mapping explicitly; \"migrated output\" is not enough to demonstrate parity.\n\nxUnit runs classes in parallel by default; MSTest runs them serially. When the current project has two or more independently runnable test classes, preserve that effective behavior with:\n\n```csharp\n[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.ClassLevel)]\n```\n\nFor a one-class project with no explicit xUnit parallel setting, do not add an assembly policy: there is no class-level concurrency to preserve. Always translate explicit `CollectionBehavior` or `xunit.runner.json` settings. Never use `ExecutionScope.MethodLevel` to emulate xUnit. Before applying a fixture-scope or parallelization decision, state what the source shared or serialized and how the target preserves it.\n\n### 6. Verify parity\n\n1. Run tests once with the same platform, filter, and configuration used for the baseline. `dotnet test` builds by default; run a separate build only when needed to isolate a compilation failure.\n2. Compare discovered, passed, failed, and skipped counts.\n3. Investigate every difference before declaring completion:\n   - missing cases -> discovery attributes, `DynamicData`, or `DataRow` literal types\n   - changed exception behavior -> exact-vs-derived assertion mapping\n   - shared-state failures or large duration changes -> fixture scope and parallelization\n   - silently skipped tests -> missing `[TestMethod]` or incorrect runtime-skip conversion\n4. Confirm no xUnit package, namespace, attribute, runner configuration, or fixture interface remains unless explicitly documented for manual follow-up.\n5. After the final passing test, read back each changed file that implements a high-risk mapping, plus any runner or parallelization configuration. In the result, name the file and the exact target APIs that implement its lifecycle, data, skip, output, assertion, fixture-scope, or parallelization behavior. Preserve type arguments and member names such as `[ClassInitialize]`, `TestContext.WriteLine`, and `Assert.IsExactInstanceOfType\u003CT>`; generic claims such as \"converted attributes\" or \"migrated output\" are not evidence of parity.\n\nKeep the final response concise and outcome-focused:\n\n- **Changed:** name the files and exact high-risk mappings applied.\n- **Verified:** give the final test command and discovered\u002Fpassed\u002Ffailed\u002Fskipped counts.\n- **Preserved:** state the unchanged target framework and test platform, plus any fixture or parallelization scope decision.\n- **Remaining:** identify manual follow-up, or say none.\n\n## Completion Criteria\n\n- Current xUnit version and test platform were identified\n- xUnit packages and source constructs were converted\n- Target framework and test platform stayed unchanged\n- Fixture scope and effective parallelization decisions are explicit, including justified omission when concurrency is not observable\n- Build succeeds\n- Test discovery and result counts match the baseline\n- Any unsupported custom extension point is called out rather than approximated\n\n## Follow-up\n\nRun `migrate-vstest-to-mtp` separately if the user also wants MTP. Use `writing-mstest-tests` only after parity is established to polish the converted MSTest code.\n",{"name":5,"license":15,"description":24},"Convert .NET tests from xUnit.net v2\u002Fv3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact\u002FTheory\u002FInlineData\u002FMemberData, assertions, IClassFixture\u002FICollectionFixture, ITestOutputHelper, TestContext cancellation, traits\u002FOwner, skips, timeouts, and xUnit parallelization. Also use when a \"convert xUnit to MSTest\" request may already be migrated: inspect and report the no-op. Do not use for xUnit v2-to-v3, MSTest upgrades, NUnit\u002FTUnit conversion, or runner-only VSTest-to-MTP migration.\n","main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","13-Testing-QA\u002Fmigrate-xunit-to-mstest","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill migrate-xunit-to-mstest",{"tool":37,"command":38},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill migrate-xunit-to-mstest",{"tool":40,"command":41},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill migrate-xunit-to-mstest","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F13-Testing-QA\u002Fmigrate-xunit-to-mstest\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fmapping-cheatsheet.md","REFERENCE","参考文档",26989,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F13-Testing-QA\u002Fmigrate-xunit-to-mstest\u002Freferences\u002Fmapping-cheatsheet.md",[52,59,66,73,80,87],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]