github avatar

Csharp Tunit

If you're writing C# unit tests with TUnit, this skill covers the practical stuff you need to know. It walks through TUnit's async assertion syntax like `await Assert.That(value).IsEqualTo(expected)`, shows how to use `[Arguments]` and `[MethodData]` for data-driven tests, and explains TUnit's lifecycle hooks from `[Before(Test)]` to `[After(Assembly)]`. The migration guide from xUnit is solid, mapping `[Fact]` to `[Test]` and explaining how TUnit's parallel execution works by default. TUnit feels like a modern take on unit testing with better fluent assertions, though the async-everywhere approach takes some getting used to.

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

Install

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

Installs into .claude/skills of the current project.

Files

TUnit Best Practices

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

Project Setup

  • Use a separate test project with naming convention [ProjectName].Tests
  • Reference TUnit package and TUnit.Assertions for fluent assertions
  • Create test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
  • Use .NET SDK test commands: dotnet test for running tests
  • TUnit requires .NET 8.0 or higher

Test Structure

  • No test class attributes required (like xUnit/NUnit)
  • Use [Test] attribute for test methods (not [Fact] like xUnit)
  • Follow the Arrange-Act-Assert (AAA) pattern
  • Name tests using the pattern MethodName_Scenario_ExpectedBehavior
  • Use lifecycle hooks: [Before(Test)] for setup and [After(Test)] for teardown
  • Use [Before(Class)] and [After(Class)] for shared context between tests in a class
  • Use [Before(Assembly)] and [After(Assembly)] for shared context across test classes
  • TUnit supports advanced lifecycle hooks like [Before(TestSession)] and [After(TestSession)]

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
1nousresearch avatardogfoodnousresearch/hermes-agentExploratory QA of web apps: find bugs, evidence, reports.6.4Kskills.sh installs
2forcedotcom 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
3forcedotcom 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
4forcedotcom 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
5julianoczkowski avatardesign-reviewjulianoczkowski/designer-skillsRun a structured design critique against the brief and codebase. Checks visual hierarchy, consistency, responsiveness, accessibility, and aesthetic fidelity. Us5.9Kskills.sh installs
6trailofbits avatarfirebase-apk-scannertrailofbits/skillsScans Android APKs for Firebase security misconfigurations including open databases, storage buckets, authentication issues, and exposed cloud functions. Use wh5.8Kskills.sh installs