Agent skill · software engineering · github
csharp-tunit
Get best practices for TUnit unit testing, including data-driven tests
Why this skill is useful
Provides specific best practices and patterns for TUnit unit testing that the AI wouldn't reliably generate on its own.
What it needs
Requires dotnet installed locally. About 3k tokens when loaded. Last updated 2026-08-07. 37,534 stars on the source repository.
What this skill does
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 MethodNameScenarioExpectedBehavior 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 Keep tests focused on a single behavior Avoid testing multiple behaviors in one test method Use TUnit's fluent assertion syntax with await Assert.That() Include only the assertions needed to verify the test case Make tests independent and idempotent (can run in any order) Avoid test interdependencies (use [DependsOn] attribute if needed) Data-Driven Tests Use [Arguments] attribute for inline test data (equivalent to xUnit's [InlineData]) Use [MethodData] for method-based test data (equivalent to xUnit's [MemberData]) Use [ClassData] for class-based test data Create custom data sources by implementing ITestDataSource Use meaningful parameter names in data-driven tests Multiple [Arguments] attributes can be applied to the same test method Assertions Use await Assert.That(value).IsEqualTo(expected) for value equality Use await Assert.That(value).IsSameReferenceAs(expected) for reference equality Use await Assert.That(v …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills github/csharp-tunit