
C# and .NET Testing Patterns
Write C# and .NET tests with xUnit, FluentAssertions, mocking and integration tests
- Repository
- affaan-m/ECC
- Stars
- 295,127
- Licence
- MIT
- Files
- 1 file
What it does
This skill gives an AI agent a reference guide for writing automated tests in C# and .NET. Once installed, the agent follows the documented patterns: structuring unit tests (Arrange-Act-Assert), parameterised tests, mocking dependencies with NSubstitute or Moq, ASP.NET Core API tests with WebApplicationFactory, database tests with Testcontainers, and a suggested folder layout for test projects. It is guidance only; it does not run anything by itself.
Great for
- C# developers who want consistent, readable xUnit tests
- Teams setting up test projects for an ASP.NET Core or .NET application
- Developers debugging slow or flaky tests who want a reference for better structure
Skip it if
- Non-.NET languages such as Python or JavaScript, since the patterns are specific to C# and .NET
- Projects that already have an established testing convention, where the agent may suggest conflicting styles
- Anyone expecting the skill to execute tests or verify correctness itself; it only supplies example code and guidance
Try asking
- “Write xUnit unit tests for my OrderService using FluentAssertions and NSubstitute”
- “Set up WebApplicationFactory integration tests for my ASP.NET Core orders API”
- “Use Testcontainers with PostgreSQL to test my repository layer”
- “Help me convert these tests to parameterised [Theory] tests with InlineData”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 1 original files, the MIT licence and an attribution note.
csharp-testing.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip csharp-testing.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip csharp-testing.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Name the libraries you already use (for example Moq instead of NSubstitute) so the agent adapts the examples to your project.
- Ask the agent to check generated tests by running dotnet test yourself, since the skill does not verify code.
- Share your existing test folder layout so the agent follows your conventions rather than the suggested tests/ structure.
What's inside
- SKILL.md
Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.