agentleFS
mag1artmag1art/skills/dotnet-testing/SKILL.md

dotnet-testing

Skill1 starsChanged 3 months agoApache-2.0View on GitHub

Use for designing, implementing, or reviewing automated tests for C#/.NET services and microservices.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use for unit, integration, API, persistence, messaging, contract, regression, and end-to-end test design.

    line 25
  2. Distinctive:

    Do not add tests that only duplicate implementation details or use fake providers where real provider behavior matters.

    line 29
  3. Distinctive:

    Use WebApplicationFactory for the API composition root.

    line 35
  4. Distinctive:

    Use Testcontainers for PostgreSQL, RabbitMQ, or other dependencies when provider behavior matters.

    line 36
  5. Distinctive:

    Use contract tests for independently deployed service boundaries.

    line 37
  6. Distinctive:

    Keep tests isolated, deterministic, and safe to run in parallel.

    line 38
  7. Distinctive:

    Run formatting, build, the smallest relevant test scope, then the full suite.

    line 48
  8. Distinctive:

    Use WebApplicationFactory for the real application composition.

    line 77

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

.NET Testing

When to Use

Use for unit, integration, API, persistence, messaging, contract, regression, and end-to-end test design.

When Not to Use

Do not add tests that only duplicate implementation details or use fake providers where real provider behavior matters.

Strategy

  • Unit-test pure domain rules and deterministic application services.
  • Integration-test HTTP, authentication, serialization, persistence, migrations, and external boundaries.
  • Use WebApplicationFactory for the API composition root.
  • Use Testcontainers for PostgreSQL, RabbitMQ, or other dependencies when provider behavior matters.
  • Use contract tests for independently deployed service boundaries.
  • Keep tests isolated, deterministic, and safe to run in parallel.
  • Assert observable behavior, status codes, error contracts, state transitions, and emitted messages.
  • Control time, randomness, IDs, and retries through injectable abstractions.

Cases

Cover success, validation, not-found, conflict, authorization, cancellation, timeout, duplicate delivery, retry, and infrastructure failure where relevant. Avoid sleeps; await readiness or poll with a bounded timeout.

Quality Gate

Run formatting, build, the smallest relevant test scope, then the full suite. Report commands and failures accurately.

dotnet format --verify-no-changes
dotnet build --no-restore
dotnet test --no-build

Example: API Integration Test

public sealed class OrdersApiTests
    : IClassFixture<WebApplicationFactory<Program>>
{
    private readonly HttpClient _client;

    public OrdersApiTests(WebApplicationFactory<Program> factory)
        => _client = factory.CreateClient();

    [Fact]
    public async Task Get_missing_order_returns_404()
    {
        using var response = await _client.GetAsync(
            "/api/orders/00000000-0000-0000-0000-000000000001");

        Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
    }
}

Use WebApplicationFactory for the real application composition. Replace the database with a test container or isolated test database when SQL/provider behavior matters; do not use EF Core InMemory as a substitute for PostgreSQL.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.