github avatar

Csharp Nunit

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.

skills.sh installs
9K
GitHub stars
41K
last updated
Aug 21, 2026

Install

$ npx -y skills add github/awesome-copilot --skill csharp-nunit --agent claude-code

Installs into .claude/skills of the current project.

Files

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
  • Use [SetUpFixture] for assembly-level setup and teardown

Standard Tests

Sponsors

Details

Repository
github.com/github/awesome-copilot
Categories
Testing & QA, Git & Pull Requests, AI & Agent Building, .NET & C#

More from github/awesome-copilot

All 318
1github avatarcsharp-mstestgithub/awesome-copilotGet best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests8.9Kskills.sh installs
2github avatarcsharp-tunitgithub/awesome-copilotGet best practices for TUnit unit testing, including data-driven tests8.9Kskills.sh installs
3nousresearch avatardogfoodnousresearch/hermes-agentExploratory QA of web apps: find bugs, evidence, reports.6.4Kskills.sh installs
4forcedotcom avatarexperience-lwc-generateforcedotcom/sf-skillsLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patte6.4Kskills.sh installs
5forcedotcom avatardx-org-manageforcedotcom/sf-skillsINVOKE this skill to execute Salesforce org operations: create scratch orgs, create org snapshots, open orgs in browser. This skill EXECUTES operations immediat6.2Kskills.sh installs
6forcedotcom avataragentforce-generateforcedotcom/sf-skillsBuild, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or a6Kskills.sh installs