# Csharp testing

> Csharp testing is an open-source agent skill for developer tools. Guides writing and reviewing xUnit tests, mocks and integration tests for .NET. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/csharp-testing
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** csharp-testing
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill gives an agent a reference of testing patterns for C# and .NET projects built on xUnit, with FluentAssertions for readable assertions and NSubstitute or Moq for mocking dependencies. It covers arrange-act-assert unit tests, parameterized Theory tests with InlineData and MemberData, and NSubstitute stubbing and call verification.

For ASP.NET Core, it shows WebApplicationFactory setups that swap in an in-memory database, and Testcontainers-based tests that run against a real PostgreSQL container. It also suggests a test project layout split into unit, integration and helper projects, along with a test data builder pattern and a table of common anti-patterns to avoid.

The skill is written around the dotnet CLI, so the agent uses commands such as dotnet test with coverage collection and name filters. No scripts are bundled; the guidance is delivered as instructions and code samples.

## When your agent uses it

> 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.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/csharp-testing)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/csharp-testing)

## Features

- **Unit test structure:** Arrange-act-assert layout with xUnit Fact tests and FluentAssertions checks.
- **Parameterized theories:** Patterns for InlineData and MemberData driven tests across many input cases.
- **NSubstitute mocking:** Stubbing repository calls and verifying that dependencies received expected arguments.
- **ASP.NET Core integration tests:** WebApplicationFactory setup with an in-memory database replacing the real one.
- **Testcontainers databases:** Running repository tests against a disposable PostgreSQL container with lifecycle hooks.
- **Test project organization:** Suggested folder layout separating unit, integration and helper projects.
- **Anti-pattern checklist:** Common testing mistakes paired with recommended fixes for review work.

## Good for

- Write xUnit tests for a C# service class
- Review existing .NET tests for flaky or implementation-coupled patterns
- Add parameterized tests for a validator with many input cases
- Set up an ASP.NET Core API integration test with WebApplicationFactory
- Mock repository dependencies with NSubstitute in unit tests

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/csharp-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/csharp-testing &&
cp -R "$tmp/.agents/skills/csharp-testing" ~/.claude/skills/csharp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/csharp-testing` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/csharp-testing` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/csharp-testing &&
cp -R "$tmp/.agents/skills/csharp-testing" ~/.agents/skills/csharp-testing &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/csharp-testing` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/csharp-testing` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/csharp-testing &&
cp -R "$tmp/.agents/skills/csharp-testing" ~/.cursor/skills/csharp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/csharp-testing` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/csharp-testing
```

Or copy the folder to `~/.gemini/skills/csharp-testing` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/csharp-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/csharp-testing &&
cp -R "$tmp/.agents/skills/csharp-testing" ~/.copilot/skills/csharp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/csharp-testing` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/csharp-testing` into your agent's skills folder as `csharp-testing`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What test libraries does Csharp testing assume?

It assumes xUnit for tests, FluentAssertions for assertions, NSubstitute or Moq for mocking, Testcontainers for real infrastructure, WebApplicationFactory for ASP.NET Core and Bogus for test data.

### When does the skill apply?

It applies when writing or reviewing xUnit tests, mocks or integration tests in a C# or .NET project, as described in its trigger text.

### Does Csharp testing run scripts or change files?

No scripts are included. It provides patterns, code samples and dotnet CLI commands for the agent to use.

### How do I install Csharp testing in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/csharp-testing to use it in all your projects, or to .claude/skills/csharp-testing in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Csharp testing run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Csharp testing?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Csharp testing?

The closest alternatives to Csharp testing are Csharp xunit, Csharp nunit, Xunit skill, Csharp tunit and Nunit skill.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Csharp xunit](https://ai-powered.com/skills/csharp-xunit): Csharp xunit is an open-source agent skill for developer tools.
- [Csharp nunit](https://ai-powered.com/skills/csharp-nunit): Csharp nunit is an open-source agent skill for developer tools.
- [Xunit skill](https://ai-powered.com/skills/xunit-skill): Xunit skill is an open-source agent skill for developer tools.
- [Csharp tunit](https://ai-powered.com/skills/csharp-tunit): Csharp tunit is an open-source agent skill for developer tools.
- [Nunit skill](https://ai-powered.com/skills/nunit-skill): Nunit skill is an open-source agent skill for developer tools.
- [Csharp mstest](https://ai-powered.com/skills/csharp-mstest): Csharp mstest is an open-source agent skill for developer tools.
- [Mstest skill](https://ai-powered.com/skills/mstest-skill): Mstest skill is an open-source agent skill for developer tools.
- [Dotnet best practices](https://ai-powered.com/skills/dotnet-best-practices): Dotnet best practices is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/csharp-testing
