cck-testing

Test .NET 10 APIs with WebApplicationFactory and Testcontainers MsSql.

2|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/s205109/AHKFlowApp --skill cck-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cck-testing
Source: https://github.com/s205109/AHKFlowApp/tree/main/.claude/skills/cck-testing
Command: npx skills add https://github.com/s205109/AHKFlowApp --skill cck-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures tests for .NET 10 applications are reliable and meaningful by avoiding in-memory databases and exercising the full stack (routing, validation, MediatR pipelines, EF Core persistence), preventing false positives and brittle assumptions about database behavior.

Core Features & Use Cases

  • Integration tests with WebApplicationFactory: exercise routing, model binding, pipeline behaviors, and full request/response lifecycles.
  • SQL Server Testcontainers: run MsSqlContainer to validate real SQL Server behavior including transactions, constraints, and migrations.
  • Handler and validator unit tests: test MediatR handlers against a real AppDbContext when needed and keep validators isolated for fast feedback.
  • Assertions and conventions: use FluentAssertions, Ardalis.Result checks, NSubstitute for doubles when necessary, and the AAA test pattern with clear naming conventions.
  • Shared expensive fixtures: reuse IClassFixture/IAsyncLifetime patterns to avoid repeated container startup for test collections.

Quick Start

Run an integration test with WebApplicationFactory configured to use a Testcontainers MsSql instance and assert that POST /api/v1/hotstrings returns 201 for a valid create request.

Frequently Asked Questions about cck-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up integration testing in .NET using WebApplicationFactory and Testcontainers MsSql?

Configure WebApplicationFactory to use a Testcontainers MsSqlContainer instance, allowing integration tests to exercise routing, model binding, and EF Core migrations against a real SQL Server database. Reuse IClassFixture and IAsyncLifetime patterns to avoid repeated container startup for test collections.

Why should I use Testcontainers MsSql instead of an in-memory database for .NET integration tests?

Using Testcontainers MsSql instead of an in-memory database prevents false positives and brittle assumptions by validating real SQL Server behavior, including transactions, constraints, and EF Core migration behaviors, ensuring tests are reliable and meaningful.

Can I test MediatR handlers directly against a real AppDbContext in .NET 10?

Yes, you can test MediatR handlers against a real AppDbContext to validate persistence behaviors. Validators should be kept isolated for fast feedback, while FluentAssertions and Ardalis.Result checks assert outcomes using the AAA test pattern.

What is the best way to structure .NET unit tests using FluentAssertions and NSubstitute?

Structure .NET unit tests using the AAA test pattern with clear naming conventions. Apply FluentAssertions for expressive assertions, use NSubstitute for doubles when necessary, and validate Ardalis.Result outcomes to ensure comprehensive coverage.

Does this .NET testing approach work for Blazor component tests alongside API endpoint validation?

Yes, this testing strategy applies to Blazor component tests as well as API endpoint validation. It exercises the full stack including MediatR pipelines and EF Core persistence, ensuring comprehensive validation across WebApplicationFactory integration tests.