Skip to content
All Skills

Nunit Skill

Generates NUnit 3 tests in C#. Covers Assert.That constraint model, parameterized tests, setup/teardown, and Moq mocking. Use when user mentions "NUnit", "[TestFixture]", "[Test]", "Assert.That", "C# unit test". Triggers on: "NUnit", "[Test]", "Assert.That", "C# test", "NUnit3".

Software Engineering|v1|Updated 7/2/2026|GitHub source
MCP get_skill({ skillId: "nunit-skill-2c25c266" })

Use this skill with your agent

Create a free account and connect via MCP

Get Started Free
# NUnit 3 Testing Skill

## Core Patterns

### Basic Test

```csharp
using NUnit.Framework;

[TestFixture]
public class CalculatorTests
{
    private Calculator _calculator;

    [SetUp]
    public void SetUp() => _calculator = new Calculator();

    [Test]
    public void Add_TwoPositiveNumbers_ReturnsSum()
    {
        Assert.That(_calculator.Add(2, 3), Is.EqualTo(5));
    }

    [Test]
    public void Divide_ByZero_ThrowsException()
    {
        Assert.Throws<DivideByZeroException>(() => _calculator.Divide(10, 0));
    }

    [TearDown]
    public void TearDown() { /* cleanup */ }
}
```

### Constraint Model (Assert.That)

```csharp
Assert.That(actual, Is.EqualTo(expected));
Assert.That(actual, Is.Not.EqualTo(unexpected));
Assert.That(value, Is.GreaterThan(5));
Assert.That(value, Is.InRange(1, 10));
Assert.That(str, Does.Contain("hello"));
Assert.That(str, Does.StartWith("He").IgnoreCase);
Assert.That(collection, Has.Count.EqualTo(3));
Assert.That(collection, Has.Member("item"));
Assert.That(collection, Is.All.GreaterThan(0));
Assert.That(obj, Is.Null);
Assert.That(obj, Is.Not.Null);
Assert.That(obj, Is.InstanceOf<MyClass>());
Assert.That(actual, Is.EqualTo(3.14).Within(0.01));

Continue reading

Sign up for a free account to view the full skill content

Login / Register
#testing#automationdotnet
Nunit Skill - AgentArmory Skill — AgentArmory