Source profileQuality 68/100

github/awesome-copilot/skills/csharp-tunit/SKILL.md

csharp-tunit

Get best practices for TUnit unit testing, including data-driven tests

Source repository stars
37,126
Declared platforms
0
Static risk flags
0
Last source update
2026-07-28
Source checked
2026-07-28

Decision brief

What it does—and where it fits

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

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/github/awesome-copilot --skill "skills/csharp-tunit"
    Safe inspection promptEditorial

    Inspect the Agent Skill "csharp-tunit" from https://github.com/github/awesome-copilot/blob/9933dcad5be5caeb288cebcd370eeeb2fc2f1685/skills/csharp-tunit/SKILL.md at commit 9933dcad5be5caeb288cebcd370eeeb2fc2f1685. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Project Setup

      Use a separate test project with naming convention [ProjectName].Tests

      Use a separate test project with naming convention [ProjectName].TestsReference TUnit package and TUnit.Assertions for fluent assertionsCreate test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
    2. 02

      Test Structure

      No test class attributes required (like xUnit/NUnit)

      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
    3. 03

      Standard Tests

      Keep tests focused on a single behavior

      Keep tests focused on a single behaviorAvoid testing multiple behaviors in one test methodUse TUnit's fluent assertion syntax with await Assert.That()
    4. 04

      Data-Driven Tests

      Use [Arguments] attribute for inline test data (equivalent to xUnit's [InlineData])

      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
    5. 05

      Assertions

      Use await Assert.That(value).IsEqualTo(expected) for value equality

      Use await Assert.That(value).IsEqualTo(expected) for value equalityUse await Assert.That(value).IsSameReferenceAs(expected) for reference equalityUse await Assert.That(value).IsTrue() or await Assert.That(value).IsFalse() for boolean conditions

    Permission review

    Static risk signals and limitations

    No configured static risk pattern was detected

    This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score68/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars37,126SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    github/awesome-copilot
    Skill path
    skills/csharp-tunit/SKILL.md
    Commit
    9933dcad5be5caeb288cebcd370eeeb2fc2f1685
    License
    MIT
    Collected
    2026-07-28
    Default branch
    main
    View the original SKILL.md

    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

    • 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(value).IsTrue() or await Assert.That(value).IsFalse() for boolean conditions
    • Use await Assert.That(collection).Contains(item) or await Assert.That(collection).DoesNotContain(item) for collections
    • Use await Assert.That(value).Matches(pattern) for regex pattern matching
    • Use await Assert.That(action).Throws<TException>() or await Assert.That(asyncAction).ThrowsAsync<TException>() to test exceptions
    • Chain assertions with .And operator: await Assert.That(value).IsNotNull().And.IsEqualTo(expected)
    • Use .Or operator for alternative conditions: await Assert.That(value).IsEqualTo(1).Or.IsEqualTo(2)
    • Use .Within(tolerance) for DateTime and numeric comparisons with tolerance
    • All assertions are asynchronous and must be awaited

    Advanced Features

    • Use [Repeat(n)] to repeat tests multiple times
    • Use [Retry(n)] for automatic retry on failure
    • Use [ParallelLimit<T>] to control parallel execution limits
    • Use [Skip("reason")] to skip tests conditionally
    • Use [DependsOn(nameof(OtherTest))] to create test dependencies
    • Use [Timeout(milliseconds)] to set test timeouts
    • Create custom attributes by extending TUnit's base attributes

    Test Organization

    • Group tests by feature or component
    • Use [Category("CategoryName")] for test categorization
    • Use [DisplayName("Custom Test Name")] for custom test names
    • Consider using TestContext for test diagnostics and information
    • Use conditional attributes like custom [WindowsOnly] for platform-specific tests

    Performance and Parallel Execution

    • TUnit runs tests in parallel by default (unlike xUnit which requires explicit configuration)
    • Use [NotInParallel] to disable parallel execution for specific tests
    • Use [ParallelLimit<T>] with custom limit classes to control concurrency
    • Tests within the same class run sequentially by default
    • Use [Repeat(n)] with [ParallelLimit<T>] for load testing scenarios

    Migration from xUnit

    • Replace [Fact] with [Test]
    • Replace [Theory] with [Test] and use [Arguments] for data
    • Replace [InlineData] with [Arguments]
    • Replace [MemberData] with [MethodData]
    • Replace Assert.Equal with await Assert.That(actual).IsEqualTo(expected)
    • Replace Assert.True with await Assert.That(condition).IsTrue()
    • Replace Assert.Throws<T> with await Assert.That(action).Throws<T>()
    • Replace constructor/IDisposable with [Before(Test)]/[After(Test)]
    • Replace IClassFixture<T> with [Before(Class)]/[After(Class)]

    Why TUnit over xUnit?

    TUnit offers a modern, fast, and flexible testing experience with advanced features not present in xUnit, such as asynchronous assertions, more refined lifecycle hooks, and improved data-driven testing capabilities. TUnit's fluent assertions provide clearer and more expressive test validation, making it especially suitable for complex .NET projects.

    Alternatives

    Compare before choosing