github avatar

Csharp Xunit

This is Claude configured to help you write proper XUnit tests with a focus on real-world patterns. It covers the essentials like Arrange-Act-Assert structure, proper test naming conventions, and constructor/IDisposable setup patterns. Where it shines is data-driven testing guidance, walking you through InlineData, MemberData, and ClassData attributes plus custom data sources. It also handles test organization with class fixtures, collection fixtures, and trait categorization. The advice is practical and opinionated, pushing you toward independent tests and proper mocking patterns. Useful when you're setting up a new test project or trying to standardize your team's testing approach.

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

Install

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

Installs into .claude/skills of the current project.

Files

XUnit Best Practices

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

Project Setup

  • Use a separate test project with naming convention [ProjectName].Tests
  • Reference Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio packages
  • Create test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
  • Use .NET SDK test commands: dotnet test for running tests

Test Structure

  • No test class attributes required (unlike MSTest/NUnit)
  • Use fact-based tests with [Fact] attribute for simple tests
  • Follow the Arrange-Act-Assert (AAA) pattern
  • Name tests using the pattern MethodName_Scenario_ExpectedBehavior
  • Use constructor for setup and IDisposable.Dispose() for teardown
  • Use IClassFixture<T> for shared context between tests in a class
  • Use ICollectionFixture<T> for shared context between multiple test classes

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
1jeffallan avatarpython-projeffallan/claude-skillsUse when building Python 3.11+ applications requiring type safety, async programming, or robust error handling. Generates type-annotated Python code, configures9.1Kskills.sh installs
2github avatarcsharp-nunitgithub/awesome-copilotGet best practices for NUnit unit testing, including data-driven tests9Kskills.sh installs
3github avatarcsharp-mstestgithub/awesome-copilotGet best practices for MSTest 3.x/4.x unit testing, including modern assertion APIs and data-driven tests8.9Kskills.sh installs
4github avatarcsharp-tunitgithub/awesome-copilotGet best practices for TUnit unit testing, including data-driven tests8.9Kskills.sh installs
5nousresearch avatardogfoodnousresearch/hermes-agentExploratory QA of web apps: find bugs, evidence, reports.6.4Kskills.sh installs
6forcedotcom 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