SKILL

csharp-testing

C# and .NET testing patterns with xUnit, FluentAssertions, mocking, integration tests, and test organization best practices. Use when writing or reviewing xUnit tests, mocks, or integration tests in a C# / .NET project.

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • C# Testing Patterns
  • When to Activate
  • Test Framework Stack
  • Unit Test Structure
  • Arrange-Act-Assert
  • Parameterized Tests with Theory
  • Mocking with NSubstitute
  • ASP.NET Core Integration Tests

Comprehensive testing patterns for .NET applications using xUnit, FluentAssertions, and modern testing practices. Writing new tests for C# code Reviewing test quality and coverage Setting up test infrastructure for .NET projects Debugging flaky or slow tests | Tool | Purpose | |---|---| | xUnit | Test framework (preferred for .NET) | | FluentAssertions | Readable assertion syntax | | NSubstitute or Moq | Mocking dependencies | | Testcontainers | Real infrastructure in integration tests | | WebApplicationFactory | ASP.NET Core integration tests | | Bogus | Realistic test data generation | | Anti-Pattern | Fix | |---|---| | Testing implementation details | Test behavior and outcomes | | Shared mutable test state | Fresh instance per test (xUnit does this via constructors) | | Thread.Sleep in async tests | Use Task.Delay with timeout, or polling helpers | | Asserting on ToString() output | Assert on typed properties | | One giant assertion per test | One logical assertion per test | | Test names describing implementation | Name by behavior: MethodExpectedResultWhenCondition | | Ignoring CancellationToken | Always pass and verify cancellation |

Source repository
affaan-m/ECC
Source file
pi/core/skills/csharp-testing/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T15:01:42.927Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.