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
{
"context": "Tests whether the agent correctly replaces external service dependencies with fakes using ConfigureTestServices in a WebApplicationFactory. Evaluates the RemoveAll pattern, fake implementations, ConfigureTestServices usage, and test isolation from real external dependencies.",
"type": "weighted_checklist",
"checklist": [
{
"name": "RemoveAll pattern used",
"description": "External service(s) are removed using `services.RemoveAll<IServiceInterface>()` before adding fake implementations (not just overwriting with AddSingleton without removing)",
"max_score": 15
},
{
"name": "Fake implementation class",
"description": "At least one fake/stub class is created that implements the service interface (e.g. FakeEmailService, FakeNotificationService)",
"max_score": 12
},
{
"name": "Fake registered as singleton",
"description": "The fake service is registered with `services.AddSingleton<IService, FakeService>()` (or transient/scoped — any DI registration is acceptable)",
"max_score": 10
},
{
"name": "ConfigureTestServices used",
"description": "Service overrides are performed inside `ConfigureTestServices` (not `ConfigureServices`)",
"max_score": 15
},
{
"name": "IClassFixture used",
"description": "Test class uses `IClassFixture<>` to receive the factory",
"max_score": 8
},
{
"name": "Tests verify isolated behavior",
"description": "At least one test exercises an endpoint that triggers the replaced service, asserting the expected behavior without calling the real external service",
"max_score": 12
},
{
"name": "FluentAssertions syntax",
"description": "Assertions use `.Should()` syntax from FluentAssertions",
"max_score": 8
},
{
"name": "Async Task [Fact]",
"description": "Test methods are declared `public async Task` and decorated with `[Fact]`",
"max_score": 8
},
{
"name": "UseEnvironment Testing",
"description": "The WebApplicationFactory calls `builder.UseEnvironment(\"Testing\")`",
"max_score": 6
},
{
"name": "DbContext descriptor removed",
"description": "If a database is used in tests, the real DbContext descriptor is removed with `SingleOrDefault` + `services.Remove()` before adding the test database",
"max_score": 6
}
]
}