一键导入
xunit
Get best practices for XUnit unit testing, including data-driven tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Get best practices for XUnit unit testing, including data-driven tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when building .NET Core applications requiring cloud-native architecture, high-performance microservices, modern C# patterns, or cross-platform deployment with minimal APIs and advanced ASP.NET Core features.
This skill embodies the principles of "Clean Code" by Robert C. Martin (Uncle Bob). Use it to transform "code that works" into "code that is clean."
Provides guidance for generating comprehensive C# unit tests in .NET projects. Use when writing, scaffolding, or improving unit tests for C# code using MSTest, NUnit, or xUnit frameworks. Covers framework detection, test structure, edge-case analysis, mocking rules, and best practices. DO NOT use for integration tests, end-to-end tests, or non-.NET languages.
Use when writing new functions, adding features, fixing bugs, or refactoring by applying TDD principles - write failing tests before implementation code, make them pass, then refactor.
Use during implementation when designing modules, functions, and components requiring SOLID principles for maintainable, flexible architecture.
Use when modifying existing files, refactoring, improving code quality, or touching legacy code by applying the Boy Scout Rule to leave code better than you found it.
| name | xunit |
| description | Get best practices for XUnit unit testing, including data-driven tests |
Your goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches.
[ProjectName].TestsCalculatorTests for Calculator)dotnet test for running tests[Fact] attribute for simple testsMethodName_Scenario_ExpectedBehaviorIDisposable.Dispose() for teardownIClassFixture<T> for shared context between tests in a classICollectionFixture<T> for shared context between multiple test classes[Theory] combined with data source attributes[InlineData] for inline test data[MemberData] for method-based test data[ClassData] for class-based test dataDataAttribute.ShouldBe for value equality.ShouldBeSameAs for reference equality.ShouldBeTrue/.ShouldBeFalse for boolean conditions.ShouldContain/Assert.ShouldNotContain for collections.ShouldThrow<T> or await .ShouldThrowAsync<T> to test exceptions[Trait("Category", "CategoryName")] for categorizationITestOutputHelper) for test diagnosticsSkip = "reason" in fact/theory attributesMore documentation about xUnit at: https://api.xunit.net/v3/3.2.2/