dotnet-test-frameworks

Provides detection patterns and assertion API references for MSTest, xUnit, NUnit, and TUnit test frameworks.

Updated May 2, 2026
One-click install
npx skills add https://github.com/hdeshev/pi-config --skill dotnet-test-frameworks-hdeshev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-test-frameworks
Source: https://github.com/hdeshev/pi-config/tree/main/agent/skills/dotnet-test-frameworks
Command: npx skills add https://github.com/hdeshev/pi-config --skill dotnet-test-frameworks-hdeshev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Analyzing .NET test code requires knowing the exact attributes, assertion APIs, and conventions of each test framework, and this reference eliminates the guesswork when detecting test smells across MSTest, xUnit, NUnit, and TUnit codebases. ## Core Features & Use Cases - Framework Detection Tables: Maps test class and method markers like [TestClass], [Fact], [TestFixture], and [TestCase] to their respective frameworks. - Assertion API Lookup: Cross-references equality, exception, collection, and string assertion syntax across frameworks, including third-party libraries like FluentAssertions and Shouldly. - Test Smell Indicators: Catalogs sleep/delay patterns, skip annotations, Mystery Guest indicators (file system, database, network access), and integration test markers. - Use Case: When a test analysis skill flags a try/catch block used for exception verification, this reference supplies the idiomatic Assert.Throws<T>() replacement for the detected framework. ## Quick Start Load this reference when analyzing a .NET test project to identify which framework each test file uses and look up the correct assertion and skip annotation syntax.

Frequently Asked Questions about dotnet-test-frameworks

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

FAQPage Schema
How do I detect which .NET test framework a test file uses?▼

Identify the framework by its attributes: [TestClass]/[TestMethod] for MSTest, [Fact]/[Theory] for xUnit, [TestFixture]/[Test] for NUnit, and [ClassDataSource] for TUnit. xUnit test classes have no class-level marker and rely on convention.

What is the difference between MSTest, xUnit, and NUnit assertion syntax?▼

MSTest uses Assert.AreEqual and Assert.IsTrue, xUnit uses Assert.Equal and Assert.True, and NUnit uses the constraint model Assert.That(x, Is.EqualTo(y)). Exception assertions use Assert.Throws<T>() in xUnit and NUnit, while MSTest offers Assert.ThrowsExactly<T>() for exact type matching.

How do I skip a test in xUnit versus NUnit?▼

xUnit skips tests with [Fact(Skip = "reason")] where the reason is required. NUnit uses [Ignore("reason")], MSTest uses [Ignore] with an optional reason, and TUnit uses [Skip("reason")].

What are common Mystery Guest patterns in .NET tests?▼

Mystery Guest indicators include File.ReadAllText, SqlConnection, DbContext without an in-memory provider, HttpClient without a custom HttpMessageHandler, and Environment.GetEnvironmentVariable. Acceptable alternatives include MemoryStream, StringReader, and InMemory database providers.

How are integration tests identified in .NET projects?▼

Integration tests are recognized by class names containing Integration, E2E, or Acceptance, by category attributes like [TestCategory("Integration")] in MSTest or [Trait("Category", "Integration")] in xUnit, and by project names ending in .IntegrationTests or .E2ETests.