Integration tests for ASP.NET Core APIs — WebApplicationFactory, xUnit, ConfigureTestServices, FluentAssertions, database isolation
97
96%
Does it follow best practices?
Impact
99%
1.45xAverage score across 5 eval scenarios
Passed
No known issues
Test project setup and WebApplicationFactory configuration
xUnit project in tests/
75%
100%
Mvc.Testing package
100%
100%
InMemory package
100%
100%
FluentAssertions package
0%
100%
Program class exposed
100%
100%
Custom factory subclass
100%
100%
ConfigureTestServices used
0%
100%
DbContext descriptor removed
100%
100%
Guid.NewGuid() database name
100%
100%
UseEnvironment Testing
0%
100%
IClassFixture on test class
100%
100%
The 5 essential integration tests
Happy path GET test
50%
100%
Validation POST test
100%
100%
Not found test
100%
100%
Persistence round-trip test
100%
100%
Error shape consistency test
100%
100%
FluentAssertions syntax
0%
100%
ReadFromJsonAsync<JsonElement>
100%
100%
GetProperty navigation
100%
100%
PostAsJsonAsync used
100%
100%
Async Task with [Fact]
100%
100%
Status code FluentAssertions
0%
100%
Authentication testing with TestAuthHandler
TestAuthHandler class
100%
100%
HandleAuthenticateAsync override
100%
100%
Claims included in ticket
100%
100%
AddAuthentication in ConfigureTestServices
0%
100%
Named scheme used
100%
100%
Protected endpoint tested
100%
100%
FluentAssertions in auth tests
0%
100%
IClassFixture used
100%
100%
Async Task [Fact]
100%
100%
SQLite in-memory database isolation
SQLite package added
100%
100%
DataSource :memory: connection string
100%
100%
DbContext descriptor removed
100%
100%
OpenConnection called
66%
66%
EnsureCreated called
100%
100%
ConfigureTestServices used
0%
100%
IClassFixture used
100%
100%
FluentAssertions syntax
0%
100%
Async Task [Fact]
100%
100%
UseEnvironment Testing
0%
100%
Service override and fake dependency injection
RemoveAll pattern used
46%
100%
Fake implementation class
100%
100%
Fake registered as singleton
100%
100%
ConfigureTestServices used
0%
100%
IClassFixture used
0%
100%
Tests verify isolated behavior
100%
100%
FluentAssertions syntax
0%
100%
Async Task [Fact]
100%
100%
UseEnvironment Testing
0%
100%
DbContext descriptor removed
33%
100%