dotnet-testing-advanced-webapi-integration-testinglisted
Install: claude install-skill rudironsoni/Synaxis
Source: kevintsengtw/dotnet-testing-agent-skills (MIT). Ported into dotnet-agent-harness.
# Web API Integration Testing
## Applicable Scenarios
**Skill Level**: Advanced
**Prerequisites**: xUnit basics, ASP.NET Core basics, Testcontainers basics, Clean Architecture
**Estimated Learning Time**: 60-90 minutes
## Learning Objectives
After completing this skill, you will be able to:
1. Establish complete Web API integration testing architecture
2. Implement modern exception handling using `IExceptionHandler`
3. Validate standard `ProblemDetails` and `ValidationProblemDetails` format
4. Use Flurl to simplify URL construction for HTTP testing
5. Use AwesomeAssertions for precise HTTP response validation
6. Establish multi-container (PostgreSQL + Redis) testing environment
## Core Concepts
### IExceptionHandler - Modern Exception Handling
The `IExceptionHandler` interface introduced in ASP.NET Core 8+ provides a more elegant error handling approach than
traditional middleware:
````csharp
/// <summary>
/// Global exception handler
/// </summary>
public class GlobalExceptionHandler : IExceptionHandler
{
private readonly ILogger<GlobalExceptionHandler> _logger;
public GlobalExceptionHandler(ILogger<GlobalExceptionHandler> logger)
{
_logger = logger;
}
public async ValueTask<bool> TryHandleAsync(
HttpContext httpContext,
Exception exception,
CancellationToken cancellationToken)
{
_logger.LogError(exception,