[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D240EDYK9W6N9RT9FSFPMZ":3,"skill-same:01M7D240EDYK9W6N9RT9FSFPMZ":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},"01M7D240EDYK9W6N9RT9FSFPMZ","migrate-nunit-to-mstest",null,"Convert .NET tests from NUnit 3\u002F4 to MSTest v4 while preserving VSTest or MTP. Use for replacing NUnit\u002FNUnit3TestAdapter packages, Test\u002FTestCase\u002F TestCaseSource\u002FValues attributes, constraint assertions, SetUp\u002FTearDown, OneTimeSetUp, SetUpFixture, FixtureLifeCycle, TestContext, categories, retries, timeouts, and NUnit parallelization. Also use when a \"convert NUnit to MSTest\" request may already be migrated: inspect and report the no-op. Do not use for NUnit version upgrades, xUnit\u002FTUnit conversion, MSTest upgrades, 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-nunit-to-mstest\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: migrate-nunit-to-mstest\ndescription: >\n  Convert .NET tests from NUnit 3\u002F4 to MSTest v4 while preserving VSTest or\n  MTP. Use for replacing NUnit\u002FNUnit3TestAdapter packages, Test\u002FTestCase\u002F\n  TestCaseSource\u002FValues attributes, constraint assertions, SetUp\u002FTearDown,\n  OneTimeSetUp, SetUpFixture, FixtureLifeCycle, TestContext, categories,\n  retries, timeouts, and NUnit parallelization. Also use when a \"convert NUnit\n  to MSTest\" request may already be migrated: inspect and report the no-op. Do\n  not use for NUnit version upgrades, xUnit\u002FTUnit conversion, MSTest upgrades,\n  or runner-only VSTest-to-MTP migration.\nlicense: MIT\n---\n\n# NUnit -> MSTest Migration\n\nConvert NUnit 3 or 4 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same test cases, and preserves pass\u002Ffail, lifecycle, data, filtering, and concurrency semantics.\n\n## Scope\n\nUse this skill only when the project contains NUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no NUnit 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- Search the current working directory for projects and source; never look for user files under this skill's directory.\n- Classify the deliverable: \"convert this project\" means edit, build, and test; \"give me a plan\" means answer without editing.\n- Preserve the user's requested project scope. Shared props may be changed only when they own NUnit package or runner configuration for that scope.\n- The final response must state the source NUnit version, preserved runner, changed files, high-risk semantic mappings, and actual test counts.\n\n## Response Mode\n\n- **Full migration request:** inspect, edit, build, and run tests. Do not stop after a plan.\n- **Focused compile error or API question:** apply only the relevant mapping.\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.\n\n## Decisions That Change the Result\n\n| Detected state | Required action |\n|---|---|\n| No NUnit package, namespace, attribute, or constraint remains | Stop, make no changes, and run the existing test command once to prove the already-MSTest project is healthy. |\n| Source uses VSTest | Preserve VSTest. Retain and update an explicit `Microsoft.NET.Test.Sdk` pin when the repository owns one; do not introduce MTP properties. |\n| Source uses MTP | Replace NUnit-specific MTP configuration with MSTest MTP configuration. Prefer `MSTest.Sdk`; with the metapackage set `EnableMSTestRunner=true` and `OutputType=Exe`. |\n| NUnit uses its default fixture lifecycle | NUnit normally shares one fixture instance across all test cases; MSTest creates a new class instance per test. Move state that must remain class-shared behind static fields initialized by `[ClassInitialize]`, or prove the state is per-test before leaving it as an instance field. |\n| NUnit has no `Parallelizable` configuration | Preserve serial execution. Do not add `[assembly: Parallelize]`; NUnit and MSTest are both serial by default. |\n| NUnit explicitly enables parallel execution | Translate the effective scope and worker count. Never infer method-level parallelism from fixture-level settings. |\n\nFor detailed mappings, search [`references\u002Fmapping-cheatsheet.md`](references\u002Fmapping-cheatsheet.md) for constructs present in the project and read only those sections.\n\n## Fast Path\n\nFor a routine migration, converge in four phases: one batched discovery pass, one edit pass, one `dotnet test`, and one concise result.\n\n- Use an existing CI\u002Ftest result as the baseline when available.\n- Run a pre-edit baseline when counts are unavailable and the project contains parameterized tests, fixture state, namespace setup, retries, custom attributes, or explicit parallelization.\n- Do not run separate restore, build, and test commands when `dotnet test` is sufficient.\n- Do not delete NUnit runner configuration until its behavior has been translated.\n\n## Workflow\n\n### 1. Establish the baseline\n\n1. Batch-read test projects, central package files, `global.json`, `.runsettings`, `testconfig.json`, and NUnit configuration.\n2. Detect NUnit from `NUnit`, `NUnit3TestAdapter`, `NUnit.Analyzers`, `NUnit.Framework`, `NUnit.Framework.Legacy`, and `using NUnit.Framework`.\n3. State whether the source is NUnit 3 or 4 from the resolved package version.\n4. Detect VSTest or MTP and preserve it. Use `platform-detection` only when ambiguous.\n5. Record target frameworks and stop if MSTest v4 does not support them.\n6. Inventory high-risk constructs:\n   - `[TestFixture(...)]`, `[TestFixtureSource]`, `[FixtureLifeCycle]`, constructors with parameters\n   - `[TestCase]`, `[TestCaseSource]`, `TestCaseData`, `[Values]`, `[Range]`, `[Random]`, `[Sequential]`, `[Pairwise]`, custom data attributes\n   - `[Theory]`, `[Datapoint]`, `[DatapointSource]`, automatic bool\u002Fenum datapoints, `Assume.That`\n   - `[OneTimeSetUp]`, `[OneTimeTearDown]`, `[SetUpFixture]`, inheritance-based setup\n   - `Assert.That`, `Assert.Multiple`, `Assert.Throws`, `Assert.Catch`, collection constraints\n   - `[Parallelizable]`, `[NonParallelizable]`, `[LevelOfParallelism]`, `[Order]`, `[SingleThreaded]`\n   - `[Apartment]`, `[RequiresThread]`, `[CancelAfter]`, `[Timeout]`\n   - `[Culture]`, `[Platform]`, `[SetCulture]`, `[SetUICulture]`\n   - `[Explicit]`, `[Repeat]`, `[Retry]`, `[MaxTime]`, categories, properties, `[TestOf]`\n   - `[DefaultFloatingPointTolerance]`, `[NonTestAssembly]`, and deprecated fixture lifecycle aliases\n\n### 2. Replace packages without switching runners\n\nRemove NUnit-specific packages being replaced, including `NUnit`, `NUnit3TestAdapter`, `NUnit.Analyzers`, NUnit console runner packages, and NUnit-specific MTP adapters.\n\nDefault to the current stable MSTest v4 metapackage resolved from the configured package source:\n\n```xml\n\u003CPackageReference Include=\"MSTest\" Version=\"4.4.0\" \u002F>\n```\n\nThe pin is illustrative for the current release; during a real migration resolve and pin the current stable version. Preserve an explicit `Microsoft.NET.Test.Sdk` dependency for VSTest when the source project owns one. When preserving MTP, prefer `MSTest.Sdk`; otherwise use `EnableMSTestRunner=true` and `OutputType=Exe`.\n\nDo not change `TargetFramework`. Remove NUnit `.runsettings` adapter settings only after translating relevant behavior.\n\n### 3. Perform the mechanical conversion\n\n| NUnit | MSTest |\n|---|---|\n| `[TestFixture]` or fixture with tests | `[TestClass]` |\n| `[Test]` | `[TestMethod]` |\n| `[TestCase(...)]` | `[TestMethod]` + `[DataRow(...)]` |\n| `[TestCaseSource(nameof(Cases))]` | `[TestMethod]` + `[DynamicData(nameof(Cases))]` |\n| `[SetUp]` \u002F `[TearDown]` | `[TestInitialize]` \u002F `[TestCleanup]` |\n| `[OneTimeSetUp]` \u002F `[OneTimeTearDown]` | static `[ClassInitialize]` \u002F `[ClassCleanup]` |\n| `[Category(value)]` | `[TestCategory(value)]` |\n| `[Property(key, value)]` | `[TestProperty(key, value)]` |\n| `[Ignore(\"reason\")]` | `[Ignore(\"reason\")]` plus `[TestMethod]` |\n| `[Timeout(ms)]` | `[Timeout(ms)]` plus `[TestMethod]` |\n| `[Retry(n)]` | `[Retry(n - 1)]` plus `[TestMethod]` when `n > 1`; remove it when `n = 1` |\n\nRemove `using NUnit.Framework;` and `using NUnit.Framework.Legacy;`. Add `using Microsoft.VisualStudio.TestTools.UnitTesting;` when using the metapackage; `MSTest.Sdk` supplies an implicit global using.\n\nDo not mechanically seal classes or flatten inherited setup methods.\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- NUnit's default `LifeCycle.SingleInstance` differs from MSTest's per-test class instances. Preserve class-shared fields explicitly.\n- `[OneTimeSetUp]` and `[OneTimeTearDown]` become static MSTest methods. Move any instance state they use to a static holder rather than merely adding `static`.\n- NUnit `Assert.Throws\u003CT>` and `Throws.TypeOf\u003CT>` require an exact exception type and map to `Assert.ThrowsExactly\u003CT>`. NUnit `Assert.Catch\u003CT>` and `Throws.InstanceOf\u003CT>` permit derived types and map to `Assert.Throws\u003CT>`.\n- NUnit `Is.TypeOf\u003CT>` maps to `Assert.IsExactInstanceOfType\u003CT>`; `Is.InstanceOf\u003CT>` maps to `Assert.IsInstanceOfType\u003CT>`.\n- NUnit equality constraints compare sequences element-by-element. Use `Assert.AreSequenceEqual` on MSTest 4.3+ or `CollectionAssert.AreEqual` with materialized lists; never use reference-based `Assert.AreEqual` for sequences.\n- `TestCase(ExpectedResult=...)` and `TestCaseData.Returns(...)` require rewriting the target test to assert the expected result.\n- Preserve per-row names, categories, and ignores by returning `TestDataRow\u003CT>` from `DynamicData` when needed. NUnit row properties have no direct `TestDataRow\u003CT>` equivalent and require a custom data source or an explicit metadata decision.\n- MSTest 4.4 combinatorial attributes can map NUnit `[Combinatorial]`, `[Values]`, `[Range]`, and `[Random]`; add `using Microsoft.VisualStudio.TestTools.UnitTesting.Combinatorial;`. Constructor semantics differ, so translate NUnit ranges and random bounds explicitly. `[Sequential]` still requires explicit rows or a custom data source.\n- NUnit `[Pairwise]` has no MSTest built-in. Preserve the exact generated rows in `DynamicData` or use a verified pairwise `ITestDataSource`; full Cartesian combinations change test counts and execution cost.\n- Convert `[Theory]`, `[Datapoint]`, and `[DatapointSource]` into explicit `DynamicData` or combinatorial sources. Preserve automatic bool\u002Fenum values and the rule that a theory fails when every row violates its assumptions.\n- `[Explicit]`, `[Repeat]`, parameterized fixtures, fixture sources, and `Assert.Multiple` have no behavior-identical mechanical mapping. Rewrite deliberately or report manual follow-up; never approximate silently.\n- NUnit `[Retry(n)]` counts the initial attempt, while MSTest `[Retry(n)]` counts retries after the initial attempt. Subtract one and review NUnit `RetryExceptions` filters separately.\n- `[CancelAfter(ms)]` maps to `[Timeout(ms, CooperativeCancellation = true)]`. Under VSTest, remove NUnit's injected `CancellationToken` parameter and use an injected or property-based `TestContext.CancellationToken`; VSTest otherwise treats it as missing data. Retain a method token only when the preserved runner is proven to support injection. Expand fixture-level defaults to every affected test and lifecycle method.\n- `[Apartment(ApartmentState.STA)]` maps to `[STATestClass]` or `[STATestMethod]`. Set `UseSTASynchronizationContext = true` when async continuations must remain on the STA thread. MTA is the MSTest default. `[RequiresThread]` and `[SingleThreaded]` guarantee thread identity that MSTest attributes do not generally preserve; use a custom executor or report manual follow-up.\n- Map NUnit platform and culture gates to `OSCondition`, `ArchitectureCondition`, or a `MemberCondition` helper. Map `SetCulture` and `SetUICulture` to setup\u002Fcleanup that saves and restores the original culture.\n- Expand `[DefaultFloatingPointTolerance]` into explicit deltas on every affected assertion. Preserve method-over-fixture-over-assembly precedence.\n\n### 5. Preserve lifecycle and namespace setup\n\n- `[SetUp]` and `[TearDown]` remain per-test lifecycle methods.\n- For NUnit's default single fixture instance, audit every mutable instance field. If tests depend on sharing, use static state created by `[ClassInitialize]` and released by `[ClassCleanup]`.\n- `[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]` already matches MSTest class instantiation; remove the attribute and keep per-test instance state.\n- `[SetUpFixture]` is namespace-scoped in NUnit. MSTest assembly initialization is assembly-wide. Use `[AssemblyInitialize]` only when the NUnit setup already covers the whole assembly; otherwise move setup into the affected classes or a shared helper without widening scope.\n- Preserve setup\u002Fcleanup inheritance order. Do not merge base and derived methods unless the resulting order is proven equivalent.\n- Map NUnit `TestContext.WriteLine` to an injected or property-based MSTest `TestContext.WriteLine`. Translate directory, test-name, and attachment APIs individually.\n\n### 6. Preserve parallelization and ordering\n\nNUnit and MSTest both run serially by default. Do not add parallelization for an unconfigured NUnit project.\n\nWhen NUnit explicitly opts in:\n\n- assembly `[Parallelizable(ParallelScope.Fixtures)]` -> `[assembly: Parallelize(Workers = N, Scope = ExecutionScope.ClassLevel)]`\n- fixture `[Parallelizable(ParallelScope.Children)]` or method-level parallelism -> method-level MSTest parallelization only after confirming shared instance state is safe\n- `[NonParallelizable]` -> `[DoNotParallelize]` when parallelization is enabled\n- `[LevelOfParallelism(N)]` -> `Workers = N`\n- resource-specific serialization can use MSTest 4.4 `[ResourceLock(\"key\")]` when it preserves a narrower lock than `[DoNotParallelize]`\n\nNUnit `[Order]` is not general dependency semantics. Use MSTest 4.4 `[DependsOn]` only when the source truly expresses a prerequisite; otherwise remove ordering by making tests independent or report manual follow-up.\n\n### 7. Verify parity\n\n1. Run tests with the same platform, filter, and configuration used for the baseline.\n2. Compare discovered, passed, failed, and skipped counts.\n3. Investigate every difference:\n   - missing rows -> `DataRow`, `DynamicData`, combinatorial, or row metadata conversion\n   - changed exceptions\u002Ftypes -> exact-vs-derived mapping\n   - state failures -> NUnit single-instance fixture semantics or setup order\n   - concurrency failures -> `Parallelize`, `DoNotParallelize`, worker count, or resource locks\n   - changed skips -> `Ignore`, `Explicit`, row-level ignore, or retry behavior\n4. Confirm no NUnit package, namespace, attribute, constraint, adapter setting, or custom NUnit extension remains unless documented for follow-up.\n5. Read back high-risk changed files and name the exact target APIs in the result.\n\nUse this final response shape:\n\n- **Changed:** files and exact high-risk mappings.\n- **Verified:** final command and discovered\u002Fpassed\u002Ffailed\u002Fskipped counts.\n- **Preserved:** target framework, test platform, fixture scope, and concurrency choice.\n- **Remaining:** manual follow-up, or none.\n\n## Completion Criteria\n\n- NUnit version and test platform were identified\n- NUnit packages and source constructs were converted\n- Target framework and test platform stayed unchanged\n- Default single-instance fixture semantics were audited and preserved where observable\n- Data-row metadata and assertion semantics were preserved\n- Namespace setup and parallelization scope were not silently widened\n- Every attribute on NUnit's official attribute index was classified as direct, rewritten, removed, or manual\n- Build succeeds and test results match the baseline\n- Unsupported custom extensions or behavior are called out\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.\n","# NUnit -> MSTest Migration\n\nConvert NUnit 3 or 4 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same test cases, and preserves pass\u002Ffail, lifecycle, data, filtering, and concurrency semantics.\n\n## Scope\n\nUse this skill only when the project contains NUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no NUnit 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- Search the current working directory for projects and source; never look for user files under this skill's directory.\n- Classify the deliverable: \"convert this project\" means edit, build, and test; \"give me a plan\" means answer without editing.\n- Preserve the user's requested project scope. Shared props may be changed only when they own NUnit package or runner configuration for that scope.\n- The final response must state the source NUnit version, preserved runner, changed files, high-risk semantic mappings, and actual test counts.\n\n## Response Mode\n\n- **Full migration request:** inspect, edit, build, and run tests. Do not stop after a plan.\n- **Focused compile error or API question:** apply only the relevant mapping.\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.\n\n## Decisions That Change the Result\n\n| Detected state | Required action |\n|---|---|\n| No NUnit package, namespace, attribute, or constraint remains | Stop, make no changes, and run the existing test command once to prove the already-MSTest project is healthy. |\n| Source uses VSTest | Preserve VSTest. Retain and update an explicit `Microsoft.NET.Test.Sdk` pin when the repository owns one; do not introduce MTP properties. |\n| Source uses MTP | Replace NUnit-specific MTP configuration with MSTest MTP configuration. Prefer `MSTest.Sdk`; with the metapackage set `EnableMSTestRunner=true` and `OutputType=Exe`. |\n| NUnit uses its default fixture lifecycle | NUnit normally shares one fixture instance across all test cases; MSTest creates a new class instance per test. Move state that must remain class-shared behind static fields initialized by `[ClassInitialize]`, or prove the state is per-test before leaving it as an instance field. |\n| NUnit has no `Parallelizable` configuration | Preserve serial execution. Do not add `[assembly: Parallelize]`; NUnit and MSTest are both serial by default. |\n| NUnit explicitly enables parallel execution | Translate the effective scope and worker count. Never infer method-level parallelism from fixture-level settings. |\n\nFor detailed mappings, search [`references\u002Fmapping-cheatsheet.md`](references\u002Fmapping-cheatsheet.md) for constructs present in the project and read only those sections.\n\n## Fast Path\n\nFor a routine migration, converge in four phases: one batched discovery pass, one edit pass, one `dotnet test`, and one concise result.\n\n- Use an existing CI\u002Ftest result as the baseline when available.\n- Run a pre-edit baseline when counts are unavailable and the project contains parameterized tests, fixture state, namespace setup, retries, custom attributes, or explicit parallelization.\n- Do not run separate restore, build, and test commands when `dotnet test` is sufficient.\n- Do not delete NUnit runner configuration until its behavior has been translated.\n\n## Workflow\n\n### 1. Establish the baseline\n\n1. Batch-read test projects, central package files, `global.json`, `.runsettings`, `testconfig.json`, and NUnit configuration.\n2. Detect NUnit from `NUnit`, `NUnit3TestAdapter`, `NUnit.Analyzers`, `NUnit.Framework`, `NUnit.Framework.Legacy`, and `using NUnit.Framework`.\n3. State whether the source is NUnit 3 or 4 from the resolved package version.\n4. Detect VSTest or MTP and preserve it. Use `platform-detection` only when ambiguous.\n5. Record target frameworks and stop if MSTest v4 does not support them.\n6. Inventory high-risk constructs:\n   - `[TestFixture(...)]`, `[TestFixtureSource]`, `[FixtureLifeCycle]`, constructors with parameters\n   - `[TestCase]`, `[TestCaseSource]`, `TestCaseData`, `[Values]`, `[Range]`, `[Random]`, `[Sequential]`, `[Pairwise]`, custom data attributes\n   - `[Theory]`, `[Datapoint]`, `[DatapointSource]`, automatic bool\u002Fenum datapoints, `Assume.That`\n   - `[OneTimeSetUp]`, `[OneTimeTearDown]`, `[SetUpFixture]`, inheritance-based setup\n   - `Assert.That`, `Assert.Multiple`, `Assert.Throws`, `Assert.Catch`, collection constraints\n   - `[Parallelizable]`, `[NonParallelizable]`, `[LevelOfParallelism]`, `[Order]`, `[SingleThreaded]`\n   - `[Apartment]`, `[RequiresThread]`, `[CancelAfter]`, `[Timeout]`\n   - `[Culture]`, `[Platform]`, `[SetCulture]`, `[SetUICulture]`\n   - `[Explicit]`, `[Repeat]`, `[Retry]`, `[MaxTime]`, categories, properties, `[TestOf]`\n   - `[DefaultFloatingPointTolerance]`, `[NonTestAssembly]`, and deprecated fixture lifecycle aliases\n\n### 2. Replace packages without switching runners\n\nRemove NUnit-specific packages being replaced, including `NUnit`, `NUnit3TestAdapter`, `NUnit.Analyzers`, NUnit console runner packages, and NUnit-specific MTP adapters.\n\nDefault to the current stable MSTest v4 metapackage resolved from the configured package source:\n\n```xml\n\u003CPackageReference Include=\"MSTest\" Version=\"4.4.0\" \u002F>\n```\n\nThe pin is illustrative for the current release; during a real migration resolve and pin the current stable version. Preserve an explicit `Microsoft.NET.Test.Sdk` dependency for VSTest when the source project owns one. When preserving MTP, prefer `MSTest.Sdk`; otherwise use `EnableMSTestRunner=true` and `OutputType=Exe`.\n\nDo not change `TargetFramework`. Remove NUnit `.runsettings` adapter settings only after translating relevant behavior.\n\n### 3. Perform the mechanical conversion\n\n| NUnit | MSTest |\n|---|---|\n| `[TestFixture]` or fixture with tests | `[TestClass]` |\n| `[Test]` | `[TestMethod]` |\n| `[TestCase(...)]` | `[TestMethod]` + `[DataRow(...)]` |\n| `[TestCaseSource(nameof(Cases))]` | `[TestMethod]` + `[DynamicData(nameof(Cases))]` |\n| `[SetUp]` \u002F `[TearDown]` | `[TestInitialize]` \u002F `[TestCleanup]` |\n| `[OneTimeSetUp]` \u002F `[OneTimeTearDown]` | static `[ClassInitialize]` \u002F `[ClassCleanup]` |\n| `[Category(value)]` | `[TestCategory(value)]` |\n| `[Property(key, value)]` | `[TestProperty(key, value)]` |\n| `[Ignore(\"reason\")]` | `[Ignore(\"reason\")]` plus `[TestMethod]` |\n| `[Timeout(ms)]` | `[Timeout(ms)]` plus `[TestMethod]` |\n| `[Retry(n)]` | `[Retry(n - 1)]` plus `[TestMethod]` when `n > 1`; remove it when `n = 1` |\n\nRemove `using NUnit.Framework;` and `using NUnit.Framework.Legacy;`. Add `using Microsoft.VisualStudio.TestTools.UnitTesting;` when using the metapackage; `MSTest.Sdk` supplies an implicit global using.\n\nDo not mechanically seal classes or flatten inherited setup methods.\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- NUnit's default `LifeCycle.SingleInstance` differs from MSTest's per-test class instances. Preserve class-shared fields explicitly.\n- `[OneTimeSetUp]` and `[OneTimeTearDown]` become static MSTest methods. Move any instance state they use to a static holder rather than merely adding `static`.\n- NUnit `Assert.Throws\u003CT>` and `Throws.TypeOf\u003CT>` require an exact exception type and map to `Assert.ThrowsExactly\u003CT>`. NUnit `Assert.Catch\u003CT>` and `Throws.InstanceOf\u003CT>` permit derived types and map to `Assert.Throws\u003CT>`.\n- NUnit `Is.TypeOf\u003CT>` maps to `Assert.IsExactInstanceOfType\u003CT>`; `Is.InstanceOf\u003CT>` maps to `Assert.IsInstanceOfType\u003CT>`.\n- NUnit equality constraints compare sequences element-by-element. Use `Assert.AreSequenceEqual` on MSTest 4.3+ or `CollectionAssert.AreEqual` with materialized lists; never use reference-based `Assert.AreEqual` for sequences.\n- `TestCase(ExpectedResult=...)` and `TestCaseData.Returns(...)` require rewriting the target test to assert the expected result.\n- Preserve per-row names, categories, and ignores by returning `TestDataRow\u003CT>` from `DynamicData` when needed. NUnit row properties have no direct `TestDataRow\u003CT>` equivalent and require a custom data source or an explicit metadata decision.\n- MSTest 4.4 combinatorial attributes can map NUnit `[Combinatorial]`, `[Values]`, `[Range]`, and `[Random]`; add `using Microsoft.VisualStudio.TestTools.UnitTesting.Combinatorial;`. Constructor semantics differ, so translate NUnit ranges and random bounds explicitly. `[Sequential]` still requires explicit rows or a custom data source.\n- NUnit `[Pairwise]` has no MSTest built-in. Preserve the exact generated rows in `DynamicData` or use a verified pairwise `ITestDataSource`; full Cartesian combinations change test counts and execution cost.\n- Convert `[Theory]`, `[Datapoint]`, and `[DatapointSource]` into explicit `DynamicData` or combinatorial sources. Preserve automatic bool\u002Fenum values and the rule that a theory fails when every row violates its assumptions.\n- `[Explicit]`, `[Repeat]`, parameterized fixtures, fixture sources, and `Assert.Multiple` have no behavior-identical mechanical mapping. Rewrite deliberately or report manual follow-up; never approximate silently.\n- NUnit `[Retry(n)]` counts the initial attempt, while MSTest `[Retry(n)]` counts retries after the initial attempt. Subtract one and review NUnit `RetryExceptions` filters separately.\n- `[CancelAfter(ms)]` maps to `[Timeout(ms, CooperativeCancellation = true)]`. Under VSTest, remove NUnit's injected `CancellationToken` parameter and use an injected or property-based `TestContext.CancellationToken`; VSTest otherwise treats it as missing data. Retain a method token only when the preserved runner is proven to support injection. Expand fixture-level defaults to every affected test and lifecycle method.\n- `[Apartment(ApartmentState.STA)]` maps to `[STATestClass]` or `[STATestMethod]`. Set `UseSTASynchronizationContext = true` when async continuations must remain on the STA thread. MTA is the MSTest default. `[RequiresThread]` and `[SingleThreaded]` guarantee thread identity that MSTest attributes do not generally preserve; use a custom executor or report manual follow-up.\n- Map NUnit platform and culture gates to `OSCondition`, `ArchitectureCondition`, or a `MemberCondition` helper. Map `SetCulture` and `SetUICulture` to setup\u002Fcleanup that saves and restores the original culture.\n- Expand `[DefaultFloatingPointTolerance]` into explicit deltas on every affected assertion. Preserve method-over-fixture-over-assembly precedence.\n\n### 5. Preserve lifecycle and namespace setup\n\n- `[SetUp]` and `[TearDown]` remain per-test lifecycle methods.\n- For NUnit's default single fixture instance, audit every mutable instance field. If tests depend on sharing, use static state created by `[ClassInitialize]` and released by `[ClassCleanup]`.\n- `[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]` already matches MSTest class instantiation; remove the attribute and keep per-test instance state.\n- `[SetUpFixture]` is namespace-scoped in NUnit. MSTest assembly initialization is assembly-wide. Use `[AssemblyInitialize]` only when the NUnit setup already covers the whole assembly; otherwise move setup into the affected classes or a shared helper without widening scope.\n- Preserve setup\u002Fcleanup inheritance order. Do not merge base and derived methods unless the resulting order is proven equivalent.\n- Map NUnit `TestContext.WriteLine` to an injected or property-based MSTest `TestContext.WriteLine`. Translate directory, test-name, and attachment APIs individually.\n\n### 6. Preserve parallelization and ordering\n\nNUnit and MSTest both run serially by default. Do not add parallelization for an unconfigured NUnit project.\n\nWhen NUnit explicitly opts in:\n\n- assembly `[Parallelizable(ParallelScope.Fixtures)]` -> `[assembly: Parallelize(Workers = N, Scope = ExecutionScope.ClassLevel)]`\n- fixture `[Parallelizable(ParallelScope.Children)]` or method-level parallelism -> method-level MSTest parallelization only after confirming shared instance state is safe\n- `[NonParallelizable]` -> `[DoNotParallelize]` when parallelization is enabled\n- `[LevelOfParallelism(N)]` -> `Workers = N`\n- resource-specific serialization can use MSTest 4.4 `[ResourceLock(\"key\")]` when it preserves a narrower lock than `[DoNotParallelize]`\n\nNUnit `[Order]` is not general dependency semantics. Use MSTest 4.4 `[DependsOn]` only when the source truly expresses a prerequisite; otherwise remove ordering by making tests independent or report manual follow-up.\n\n### 7. Verify parity\n\n1. Run tests with the same platform, filter, and configuration used for the baseline.\n2. Compare discovered, passed, failed, and skipped counts.\n3. Investigate every difference:\n   - missing rows -> `DataRow`, `DynamicData`, combinatorial, or row metadata conversion\n   - changed exceptions\u002Ftypes -> exact-vs-derived mapping\n   - state failures -> NUnit single-instance fixture semantics or setup order\n   - concurrency failures -> `Parallelize`, `DoNotParallelize`, worker count, or resource locks\n   - changed skips -> `Ignore`, `Explicit`, row-level ignore, or retry behavior\n4. Confirm no NUnit package, namespace, attribute, constraint, adapter setting, or custom NUnit extension remains unless documented for follow-up.\n5. Read back high-risk changed files and name the exact target APIs in the result.\n\nUse this final response shape:\n\n- **Changed:** files and exact high-risk mappings.\n- **Verified:** final command and discovered\u002Fpassed\u002Ffailed\u002Fskipped counts.\n- **Preserved:** target framework, test platform, fixture scope, and concurrency choice.\n- **Remaining:** manual follow-up, or none.\n\n## Completion Criteria\n\n- NUnit version and test platform were identified\n- NUnit packages and source constructs were converted\n- Target framework and test platform stayed unchanged\n- Default single-instance fixture semantics were audited and preserved where observable\n- Data-row metadata and assertion semantics were preserved\n- Namespace setup and parallelization scope were not silently widened\n- Every attribute on NUnit's official attribute index was classified as direct, rewritten, removed, or manual\n- Build succeeds and test results match the baseline\n- Unsupported custom extensions or behavior are called out\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.\n",{"name":5,"license":15,"description":24},"Convert .NET tests from NUnit 3\u002F4 to MSTest v4 while preserving VSTest or MTP. Use for replacing NUnit\u002FNUnit3TestAdapter packages, Test\u002FTestCase\u002F TestCaseSource\u002FValues attributes, constraint assertions, SetUp\u002FTearDown, OneTimeSetUp, SetUpFixture, FixtureLifeCycle, TestContext, categories, retries, timeouts, and NUnit parallelization. Also use when a \"convert NUnit to MSTest\" request may already be migrated: inspect and report the no-op. Do not use for NUnit version upgrades, xUnit\u002FTUnit conversion, MSTest upgrades, or runner-only VSTest-to-MTP migration.\n","main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","13-Testing-QA\u002Fmigrate-nunit-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-nunit-to-mstest",{"tool":37,"command":38},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill migrate-nunit-to-mstest",{"tool":40,"command":41},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill migrate-nunit-to-mstest","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F13-Testing-QA\u002Fmigrate-nunit-to-mstest\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fmapping-cheatsheet.md","REFERENCE","参考文档",17143,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F13-Testing-QA\u002Fmigrate-nunit-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",[],[]]