csharp-nunit

Originally fromgithub/awesome-copilot
Installation
SKILL.md

NUnit Best Practices

Your goal is to help me write effective unit tests with NUnit, covering both standard and data-driven testing approaches.

Project Setup

  • Use a separate test project with naming convention [ProjectName].Tests
  • Reference Microsoft.NET.Test.Sdk, NUnit, and NUnit3TestAdapter packages
  • Create test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
  • Use .NET SDK test commands: dotnet test for running tests

Test Structure

  • Apply [TestFixture] attribute to test classes
  • Use [Test] attribute for test methods
  • Follow the Arrange-Act-Assert (AAA) pattern
  • Name tests using the pattern MethodName_Scenario_ExpectedBehavior
  • Use [SetUp] and [TearDown] for per-test setup and teardown
  • Use [OneTimeSetUp] and [OneTimeTearDown] for per-class setup and teardown
Related skills
Installs
10
GitHub Stars
5.4K
First Seen
10 days ago