/csharp-dotnet-development:csharp-nunitfrom csharp-dotnet-development
Designs, writes, and reviews NUnit tests for .NET projects, covering data-driven tests, assertions, setup/teardown, categories, and mock isolation.
Ships in csharp-dotnet-development. 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
9 skills in this plugin
/aspnet-minimal-api-openapiCreate or review ASP.NET Minimal API endpoints with typed results, DTO validation, endpoint groups, filters, ProblemDetails, and OpenAPI documentation. Use this skill when asked to add Minimal APIs, document endpoints with Swagger/OpenAPI, use .NET 9 built-in OpenAPI, or design request and response types./csharp-asyncReview, design, and fix C# async code using Task, Task<T>, ValueTask<T>, cancellation, ConfigureAwait, async streams, and TAP conventions. Use when the user asks for C# async best practices, deadlock fixes, async method naming, parallel awaits, or replacing .Wait(), .Result, and async void./csharp-mstestApply modern MSTest 3.x/4.x testing practices for C# projects. Use when asked to write or review MSTest unit tests, choose assertion APIs, convert ExpectedException tests, design data-driven tests, use TestContext, configure lifecycle hooks, add categories or work items, or run dotnet test for MSTest./csharp-tunitWrite, review, or migrate C# unit tests using TUnit. Use when the user asks for TUnit best practices, .NET test project setup, TUnit assertions, lifecycle hooks, data-driven tests, parallel execution, retries, categories, or xUnit-to-TUnit migration./csharp-xunitApply xUnit best practices for C# unit tests, including test project setup, Fact and Theory structure, data-driven tests, assertions, fixtures, mocking, categorization, diagnostics, and dotnet test execution. Use when asked for xUnit guidance or to write .NET unit tests./dotnet-best-practicesReview or improve .NET and C# code against solution/project best practices for documentation, architecture, dependency injection, resources, async, tests, configuration, Semantic Kernel, logging, performance, security, SOLID, and code quality. Use when asked for .net/c# or .NET/C# best practices or cleanup.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin csharp-dotnet-developmentOther plugins' skills for the same job