testing

Guide .NET 10 integration testing with xUnit v3, WebApplicationFactory, and Testcontainers.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill testing-trossitec
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/Trossitec/dotnet-claude-kit/tree/main/skills/testing
Command: npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill testing-trossitec

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The testing skill prevents brittle or misleading .NET test suites by guiding you toward high-value integration testing and reliable patterns that match real production behavior.

Core Features & Use Cases

  • Integration-first testing with WebApplicationFactory: Validate the full HTTP pipeline (routing, validation, business logic, persistence) using realistic host configuration.
  • Real database testing via Testcontainers: Replace in-memory databases with real PostgreSQL/SQL Server containers to catch SQL, constraint, and transaction issues.
  • Deterministic correctness with AAA and time control: Enforce Arrange/Act/Assert structure and use TimeProvider/FakeTimeProvider patterns for time-dependent logic.
  • Higher-signal verification patterns: Use Verify for snapshot-style assertions and builders to keep test data expressive and consistent.

Quick Start

Load the testing skill when you are creating xUnit v3 unit or integration tests and you want to wire WebApplicationFactory with Testcontainers for real PostgreSQL or SQL Server behavior.

Frequently Asked Questions about testing

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

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

Integration testing in .NET 10 uses WebApplicationFactory to validate the HTTP pipeline and Testcontainers to provision real PostgreSQL or SQL Server databases, catching SQL and transaction issues. This replaces in-memory databases with real infrastructure for reliable test results.

Why should I avoid in-memory databases for .NET integration tests?

In-memory databases for .NET integration tests miss real SQL constraints, transaction behaviors, and provider-specific quirks. Using Testcontainers with actual PostgreSQL or SQL Server containers provides high-value verification matching production behavior, preventing misleading test outcomes.

How do I test time-dependent logic in xUnit v3?

Testing time-dependent logic in xUnit v3 uses TimeProvider and FakeTimeProvider patterns to control time deterministically. This ensures reliable assertions for scheduled tasks or temporal business logic without relying on system clocks or artificial delays.

What is the best way to structure xUnit v3 tests for .NET applications?

The best way to structure xUnit v3 tests is enforcing strict Arrange-Act-Assert separation while avoiding implementation-detail assertions. This approach focuses on observable behavior and higher-signal verification using snapshot testing with Verify and deterministic test data builders.

Does snapshot testing with Verify work for .NET 10 integration tests?

Snapshot testing with Verify works for .NET 10 integration tests by capturing and validating complex outputs against baseline files. Combined with deterministic test data builders, it provides higher-signal verification and reduces brittle implementation-detail assertions.

Can I use WebApplicationFactory to test routing and validation in .NET 10?

WebApplicationFactory tests routing, validation, business logic, and persistence in .NET 10 by configuring a realistic test host. It validates the full HTTP pipeline end-to-end, ensuring integration tests accurately reflect production request handling behavior.