Microsoft.AspNetCore.Mvc.Testing
Bootstraps ASP.NET Core applications in tests via TestServer/WebApplicationFactory for high-fidelity HTTP integration tests.
Decision Guide
Integration tests should validate real boundaries: HTTP, serialization, persistence, and infrastructure contracts. Pick tools that match the deployment topology you actually run, then optimize test speed with controlled fixture lifetimes and deterministic data resets.
The decision to make
How should a .NET solution structure integration tests for APIs and dependent services?
Curated starting points to compare. Always evaluate suitability against your specific project requirements.
Bootstraps ASP.NET Core applications in tests via TestServer/WebApplicationFactory for high-fidelity HTTP integration tests.
Provision disposable Docker-based dependencies (databases, brokers, caches) directly from tests.
Coordinates distributed .NET Aspire applications in tests with resource discovery and health-aware orchestration.
Define the boundary under test: application host, real HTTP pipeline, database, message broker, or distributed topology. Use the cheapest setup that still proves the production-relevant contract.
Create isolated fixture lifetimes and a repeatable data reset strategy. Prefer ephemeral containers for database-specific behavior and seed only the records required by each scenario.
Capture server logs, response payloads, and trace IDs when a test fails. Test security middleware and serialization through real HTTP requests, not only service-method calls.
Risk
Checklist
Revisit the integration test stack when adding new infrastructure dependencies, shifting to distributed services, or tightening CI cycle times.