
A solid reference for NUnit testing patterns that covers the practical stuff you actually need. Walks you through proper test project setup with the right NuGet packages, explains the AAA pattern and good naming conventions, and shows you how to use TestCase and TestCaseSource for data-driven tests. The constraint model assertions (Assert.That with Is.EqualTo) are well-explained since they're more readable than the classic style. Good coverage of attributes like SetUp, TearDown, and Category for organizing tests. If you're moving from MSTest or just want to write cleaner NUnit tests, this hits the common scenarios without getting lost in edge cases.
$ npx -y skills add github/awesome-copilot --skill csharp-nunit --agent claude-codeInstalls into .claude/skills of the current project.
Your goal is to help me write effective unit tests with NUnit, covering both standard and data-driven testing approaches.
[ProjectName].TestsCalculatorTests for Calculator)dotnet test for running tests[TestFixture] attribute to test classes[Test] attribute for test methodsMethodName_Scenario_ExpectedBehavior[SetUp] and [TearDown] for per-test setup and teardown[OneTimeSetUp] and [OneTimeTearDown] for per-class setup and teardown[SetUpFixture] for assembly-level setup and teardown[TestCase] for inline test data[TestCaseSource] for programmatically generated test data[Values] for simple parameter combinations[ValueSource] for property or method-based data sources[Random] for random numeric test values[Range] for sequential numeric test values[Combinatorial] or [Pairwise] for combining multiple parametersAssert.That with constraint model (preferred NUnit style)Is.EqualTo, Is.SameAs, Contains.ItemAssert.AreEqual for simple value equality (classic style)CollectionAssert for collection comparisonsStringAssert for string-specific assertionsAssert.Throws<T> or Assert.ThrowsAsync<T> to test exceptions[Category("CategoryName")][Order] to control test execution order when necessary[Author("DeveloperName")] to indicate ownership[Description] to provide additional test information[Explicit] for tests that shouldn't run automatically[Ignore("Reason")] to temporarily skip testsSponsors