/testing-automation:csharp-nunitfrom testing-automation
Designs, writes, and reviews NUnit tests for .NET projects, covering data-driven tests, assertions, setup/teardown, categories, and mock isolation.
Ships in testing-automation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Write focused NUnit tests that follow Arrange-Act-Assert, use the NUnit constraint model, isolate units under test, and keep data-driven cases readable and deterministic.
[TestCaseSource]."| Concern | Rule |
|---|---|
| Test project | Use a separate project named [ProjectName].Tests. |
| Packages | Reference Microsoft.NET.Test.Sdk, NUnit, and NUnit3TestAdapter. |
| Test command | Run tests with dotnet test. |
| Class naming | Match production classes, such as CalculatorTests for Calculator. |
| Test naming | Use MethodName_Scenario_ExpectedBehavior. |
| Grouping | Group tests by feature or component; use [Category("CategoryName")] for suites. |
| NUnit feature | Use for | Caution |
|---|---|---|
[TestFixture] | Marking a test class when explicit fixture metadata helps. | Modern NUnit can discover many classes without it, but keep it when the project uses it consistently. |
[Test] | A single focused test method. | Do not test multiple behaviors in one method. |
[SetUp] / [TearDown] | Per-test setup and cleanup. | Avoid hidden assertions or expensive shared state; this is the per-test hook. |
[OneTimeSetUp] / [OneTimeTearDown] | Per-class expensive setup and cleanup. | Do not mutate shared state across tests unless reset; this is the per-class hook. |
[SetUpFixture] | Assembly-level setup and teardown. | Use sparingly; assembly-level fixtures can hide global coupling. |
[Order] | Rarely, when an external workflow truly requires order. | Prefer independent tests that can run in any order. |
[Explicit] | Tests that should not run automatically. | Explain why manual execution is required. |
[Ignore("Reason")] | Temporary skip. | Include a reason and remove when fixed. |
[Author("DeveloperName")] and [Description] | Metadata required by team conventions. | Do not use metadata instead of readable test names. |
| Attribute | Use when | Example shape |
|---|---|---|
[TestCase] | Inline values are short and obvious. | [TestCase(1, 2, 3)] |
[TestCaseSource] | Cases need objects, generated values, or descriptive names. | Static method/property returning cases. |
[Values] | Simple value lists for one parameter. | Combine with [Combinatorial] or [Pairwise]. |
[ValueSource] | Values come from a property, field, or method-based source. | Keep source deterministic. |
[Random] | Numeric fuzzing where nondeterminism is acceptable. | Record failures and prefer bounded ranges. |
[Range] | Sequential numeric inputs. | Use small ranges to keep tests fast. |
[Combinatorial] | All parameter combinations matter. | Watch explosion in case count. |
[Pairwise] | Broad interaction coverage with fewer cases. | Use when exhaustive combinations are unnecessary. |
| Need | Preferred NUnit pattern |
|---|---|
| General assertions | Assert.That(actual, Is.EqualTo(expected)) using the constraint model. |
| Value equality | Use Is.EqualTo inside Assert.That(actual, Is.EqualTo(expected)). |
| Reference equality | Use Is.SameAs inside Assert.That(actual, Is.SameAs(expected)). |
| Collection contains | Use Contains.Item inside Assert.That(items, Contains.Item(expected)) or CollectionAssert when project style uses it. |
| String-specific checks | StringAssert or equivalent constraints; keep string-specific assertions readable. |
| Exceptions | Assert.Throws<T> for sync code and Assert.ThrowsAsync<T> for async code. |
| Failure clarity | Add descriptive assertion messages only when the expression is not self-explanatory. |
| Mocking | Use Moq or NSubstitute through interfaces to isolate dependencies. |
| Complex setup | Prefer small factories or a DI container only when it makes dependencies clearer. |
[SetUp]: setup should arrange shared fixtures, not perform the act being tested.[Order]: ordered tests usually indicate state leakage.[Random] can make failures hard to reproduce if ranges and assumptions are unclear.## NUnit test result
**Status:** ready | needs changes | blocked
**Target:** <class, method, or behavior>
| Test | Pattern | Assertion | Notes |
| --- | --- | --- | --- |
| `MethodName_Scenario_ExpectedBehavior` | `[Test]` or `[TestCase]` | `Assert.That(...)` | <setup/mock/data source> |
### Validation
- `dotnet test`: pass | fail | not run
MethodName_Scenario_ExpectedBehavior or the repository's established equivalent.[TestCase], [TestCaseSource], [Values], [ValueSource], [Random], [Range], [Combinatorial], or [Pairwise] intentionally.Assert.That with constraints unless project style requires classic assertions such as Assert.AreEqual.Assert.Throws<T> or Assert.ThrowsAsync<T>.dotnet test.What SKILL.md sets; muted values are Claude Code's defaults
13 skills in this plugin
/ai-prompt-engineering-safety-reviewReview and improve AI prompts for safety, bias, security, privacy, effectiveness, robustness, and testability. Use this skill when the user asks to audit a prompt, harden a system prompt, identify prompt injection risk, reduce bias, improve guardrails, or produce a safer enhanced prompt./java-junitApply JUnit 5 best practices for Java tests, including Maven or Gradle setup, standard and parameterized tests, lifecycle hooks, assertions, Mockito isolation, tags, nested tests, and test commands. Use when asked for JUnit 5+ guidance or to write Java unit tests./javascript-typescript-jestWrite and review JavaScript and TypeScript Jest tests with strong structure, mocks, async handling, snapshots, and React Testing Library patterns. Use this skill when the user asks to add Jest tests, improve test structure, mock APIs or databases, test async code, update snapshots, or test React components./pester-migrationUpgrade PowerShell Pester test suites across major versions v3 to v4, v4 to v5, and v5 to v6 while preserving test intent. Use when asked to migrate, modernize, or fix *.Tests.ps1 files after a Pester version bump, convert legacy Should or Invoke-Pester syntax, handle Discovery/Run failures, move setup into BeforeAll, migrate mocks, or adopt PesterConfiguration./pester-should-migrationConvert classic Pester v5 `Should -...` assertions to Pester v6 `Should-*` assertion commands while preserving behavior. Use when asked to migrate, convert, rewrite, or modernize `Should -Be`, `Should -Not -Be`, `Should -Throw`, `Should -Invoke`, or other assertions in .Tests.ps1 and PowerShell files./playwright-automation-fill-in-formAutomate filling and reviewing a Microsoft Forms response with Playwright MCP. Use this skill when the user asks to open a form, fill specific fields, upload an image, or prepare but not submit a Playwright-driven form response.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin testing-automationOther plugins' skills for the same job