csharp-testing

Standardize C# and .NET test patterns with xUnit, NSubstitute, and Testcontainers.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill csharp-testing-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-testing
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/csharp-testing
Command: npx skills add https://github.com/luongldptit/move-ticket --skill csharp-testing-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing inconsistent, low-coverage, or flaky tests for C# and .NET applications leads to undetected production bugs and wasted debugging time, and this Skill provides standardized patterns to eliminate those issues.

Core Features & Use Cases

  • Structured Unit Testing: Guidance on xUnit setup, Arrange-Act-Assert pattern, parameterized tests, and test data builders to reduce boilerplate.
  • Mocking and Integration Testing: Examples for mocking dependencies with NSubstitute, and configuring integration tests with WebApplicationFactory and Testcontainers for real infrastructure testing.
  • Test Quality Best Practices: Anti-pattern avoidance, test organization conventions, and test execution commands to improve test reliability and maintainability.
  • Use Case: For a .NET e-commerce application, use this Skill to write unit tests for order processing services, integration tests for API endpoints, and organize tests into logical project structures.

Quick Start

Use the csharp-testing skill to create a unit test for your C# order service that verifies successful order placement using mocked repository dependencies.

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# unit tests using xUnit to reduce boilerplate?

To structure C# unit tests with xUnit, apply the Arrange-Act-Assert pattern, use parameterized tests, and implement test data builders. This approach reduces boilerplate and ensures consistent test organization across .NET projects.

What's the best way to mock dependencies for .NET integration testing?

The best way to mock dependencies in .NET is using NSubstitute for unit tests, and configuring integration tests with WebApplicationFactory and Testcontainers to validate real infrastructure without flaky test patterns.

How do I avoid flaky test patterns in C# .NET applications?

To avoid flaky test patterns in C# .NET, adhere to standardized testing best practices, organize tests into logical project structures, and use Testcontainers for reliable integration test infrastructure configuration.

Can I use FluentAssertions with xUnit for C# test quality review?

Yes, you can use FluentAssertions with xUnit to improve C# test quality review. This combination supports anti-pattern avoidance and enhances test reliability through clear assertion syntax and structured test execution.

Does WebApplicationFactory work with Testcontainers for .NET API endpoint testing?

Yes, WebApplicationFactory works with Testcontainers for .NET API endpoint testing. This combination allows you to configure integration tests with real infrastructure, eliminating low-coverage and inconsistent test execution.

When do I need NSubstitute versus Testcontainers in a .NET testing setup?

You need NSubstitute for mocking dependencies in isolated C# unit tests, while Testcontainers is required for integration testing with real infrastructure like databases, ensuring comprehensive test coverage for .NET applications.