csharp-testing

Apply C#/.NET testing patterns with xUnit, FluentAssertions, and mocking frameworks.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/richardnpaul/everything-vscode-copilot --skill csharp-testing-richardnpaul
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-testing
Source: https://github.com/richardnpaul/everything-vscode-copilot/tree/main/.github/skills/csharp-testing
Command: npx skills add https://github.com/richardnpaul/everything-vscode-copilot --skill csharp-testing-richardnpaul

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

C# testing patterns to improve reliability, readability, and organization of tests, reducing flaky results and maintenance overhead.

Core Features & Use Cases

  • xUnit-based unit testing patterns with FluentAssertions for readable assertions
  • Mocking strategies using NSubstitute or Moq, plus integration and automated testing approaches
  • Guidance on test organization, data builders, and infrastructure tests (WebApplicationFactory, Testcontainers)

Quick Start

Start by selecting a .NET project and applying the recommended testing patterns to structure and validate your tests.

Frequently Asked Questions about csharp-testing

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

FAQPage Schema
How do I structure C# integration tests using Testcontainers and WebApplicationFactory?

Structure C# integration tests by combining Testcontainers with WebApplicationFactory to provision realistic infrastructure environments. This approach validates application behavior against actual dependencies, ensuring deterministic tests and reducing flaky results across .NET projects.

What is the best way to write readable assertions in xUnit for .NET?

Write readable assertions in xUnit by applying FluentAssertions patterns. FluentAssertions provides a fluent syntax that clarifies expected outcomes, improving test readability and generating descriptive failure messages for .NET unit testing.

How do I create maintainable test data builders for C# unit tests?

Create maintainable test data builders for C# unit tests by applying reusable test organization patterns. These builders construct valid test objects with default values, reducing boilerplate setup code and ensuring deterministic test data across xUnit projects.

Should I use NSubstitute or Moq for mocking in .NET testing?

Choose between NSubstitute and Moq for .NET mocking based on your syntax preference. Both frameworks support isolated unit testing, but applying consistent mocking strategies improves test maintainability and reduces setup complexity across C# projects.

Why are my C# integration tests flaky and how can I make them deterministic?

C# integration tests become flaky due to unreliable infrastructure or shared state. Make them deterministic by using Testcontainers for isolated environments and WebApplicationFactory for consistent server setup, ensuring reliable test execution across .NET projects.

How do I organize unit and integration test projects in a .NET solution?

Organize unit and integration test projects in a .NET solution by separating fast-running xUnit unit tests from slower Testcontainers integration tests. This separation improves build times and allows targeted test execution, ensuring maintainable test organization.