← ClaudeAtlas

csharp-xunitlisted

xUnit testing patterns and data-driven test guidance. Use when writing or reviewing .NET unit tests.
bg-szy/TOP-SKILLS · ★ 1 · AI & Automation · score 70
Install: claude install-skill bg-szy/TOP-SKILLS
# XUnit Best Practices > Optimized for current .NET SDK releases, C# 12+, xUnit 2.x, and FluentAssertions 6+. Your goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches. - Leverage native parallel subagent dispatch and 200k+ context windows where available. ## Anti-Patterns - Treating fixtures as hidden setup: Readers lose sight of the behavior under test when too much state is shared implicitly. - Asserting only the happy path: Unit tests miss the contract if failure and edge cases are not explicit. - Using vague test names: A failing test should explain the broken behavior before anyone opens the body. ## Verification Protocol Before claiming "skill applied successfully": 1. Pass/fail: The Csharp Xunit implementation names the target runtime, framework version, and affected files. 2. Pass/fail: Build, lint, test, or equivalent local validation is run for the changed surface. 3. Pass/fail: Edge cases for errors, dependency drift, and environment differences are addressed or explicitly out of scope. 4. Pressure-test scenario: Apply the workflow to a change that passes happy-path tests but fails one boundary condition. 5. Success metric: Zero untested success claims; every implementation claim maps to a command or artifact. ## Before and After Example ```csharp // Before [Fact] public async Task SavesOrder() { var id = await service.SaveAsync(order); Assert.True(id > 0); } // After [Fact] public