csharp-unit-test

Standardize xUnit v3 C# tests with naming conventions and Theory/InlineData structure.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/RushuiGuan/claude --skill csharp-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-unit-test
Source: https://github.com/RushuiGuan/claude/tree/main/skills/csharp-unit-test
Command: npx skills add https://github.com/RushuiGuan/claude --skill csharp-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing and maintaining xUnit v3 unit tests in C# can be inconsistent across methods and projects. This skill codifies clear conventions to ensure each test mirrors the same structure and naming patterns.

Core Features & Use Cases

  • One file per method under test, named ClassName_MethodName.cs.
  • Use [Theory] + [InlineData] for multiple inputs; [Fact] for single-case tests.
  • Guiding test naming and file layout to improve readability and maintainability across a codebase.

Quick Start

Create a new test file named ClassName_MethodName.cs in the test project and name tests by their scenario.

Frequently Asked Questions about csharp-unit-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize xUnit test structure for C# projects?

Standardize xUnit test structure by applying one file per method named ClassName_MethodName.cs and using consistent test naming. This ensures consistent test layout and improves readability across methods and projects.

When should I use Theory with InlineData instead of Fact in xUnit?

Use [Theory] with [InlineData] instead of [Fact] when testing a method with multiple inputs. This maximizes test coverage and minimizes code duplication, whereas [Fact] is preferred for single-case tests.

What is the best way to name xUnit test files for C# classes?

The best way to name xUnit test files is using the ClassName_MethodName.cs convention. This creates a one-to-one mapping between the method under test and its corresponding test file, improving maintainability.

Can I scaffold multiple xUnit test cases for new C# methods automatically?

You can scaffold multiple xUnit test cases by generating a new ClassName_MethodName.cs file and applying [Theory] with [InlineData]. This covers multiple inputs and scenarios while adhering to standardized testing conventions.

Does this xUnit testing convention apply to C# v3 specifically?

Yes, these xUnit testing conventions are designed specifically for xUnit v3 unit testing in C#. They define file layout rules and naming conventions to ensure reliable and consistent test structure.