
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-codeInstalls 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.,
CalculatorTestsforCalculator) - Use .NET SDK test commands:
dotnet testfor 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- Code Exemplars Blueprint Generator8.8K
- Update Llms8.8K
- Structured Autonomy Plan8.8K
- Workiq Copilot8.8K
- Create Tldr Page8.8K
- Mcp Deploy Manage Agents8.8K
- Bigquery Pipeline Audit8.8K
- Java Mcp Server Generator8.8K
- Mkdocs Translations8.8K
- Tldr Prompt8.8K
- Copilot Cli Quickstart8.8K
- Suggest Awesome Github Copilot Agents8.8K
- Fedora Linux Triage8.8K
- Suggest Awesome Github Copilot Instructions8.8K
- First Ask8.8K
- Typespec Api Operations8.8K
- Structured Autonomy Implement8.8K
- Swift Mcp Server Generator8.8K
- Fabric Lakehouse8.8K
- Gen Specs As Issues8.8K
- Power Apps Code App Scaffold8.7K
- Dataverse Python Quickstart8.7K
- Structured Autonomy Generate8.7K
- Java Add Graalvm Native Image Support8.7K