csharp-nunit

Guides writing NUnit unit tests with standard and data-driven testing patterns.

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill csharp-nunit-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-nunit
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/csharp-nunit
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill csharp-nunit-viniciuscs84

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, maintainable unit tests in C# requires knowing NUnit's attributes, assertion styles, and data-driven testing features, which developers often apply inconsistently across a codebase. ## Core Features & Use Cases - Test Structure Guidance: Enforces conventions like the Arrange-Act-Assert pattern, [TestFixture]/[Test] attributes, and the MethodName_Scenario_ExpectedBehavior naming pattern. - Data-Driven Testing: Covers [TestCase], [TestCaseSource], [Values], [Range], and combinatorial approaches for parameterized tests. - Assertions and Organization: Recommends the constraint model with Assert.That, exception assertions, categories, and setup/teardown lifecycle hooks. - Use Case: When adding tests for a new Calculator class, use this Skill to scaffold a CalculatorTests fixture with proper setup, parameterized test cases, and constraint-based assertions. ## Quick Start Help me write NUnit unit tests for my C# class using data-driven test cases and the Arrange-Act-Assert pattern.

Frequently Asked Questions about csharp-nunit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write data-driven tests in NUnit?

Use [TestCase] for inline test data, [TestCaseSource] for programmatically generated data, and [Values] or [Range] for parameter combinations. Combine multiple parameters with [Combinatorial] or [Pairwise] attributes.

How to structure NUnit test projects in C#?

Create a separate test project named [ProjectName].Tests referencing Microsoft.NET.Test.Sdk, NUnit, and NUnit3TestAdapter. Mirror test classes to the classes under test, such as CalculatorTests for Calculator, and run tests with dotnet test.

What is the difference between Assert.That and Assert.AreEqual in NUnit?

Assert.That uses the constraint model with expressions like Is.EqualTo and is the preferred NUnit style. Assert.AreEqual is the classic style for simple value equality, while CollectionAssert and StringAssert handle specific types.

Can I use Moq or NSubstitute with NUnit?

Yes, NUnit works alongside mocking libraries like Moq or NSubstitute to isolate units under test. Mock dependencies through interfaces, and consider a DI container for complex test setups.

How do I skip or organize NUnit tests?

Use [Ignore("Reason")] to temporarily skip tests and [Explicit] for tests that should not run automatically. Organize tests with [Category], control order with [Order], and document ownership with [Author] and [Description].