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 writes the five canonical integration tests for an ASP.NET Core API. Evaluates correct use of FluentAssertions, ReadFromJsonAsync<JsonElement>, PostAsJsonAsync, GetProperty JSON navigation, async Task [Fact] methods, and coverage of all five essential test patterns.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Happy path GET test",
"description": "A test performs a GET request and asserts the response status is 200 OK using FluentAssertions `.Should().Be(HttpStatusCode.OK)`",
"max_score": 8
},
{
"name": "Validation POST test",
"description": "A test performs a POST with invalid/empty input and asserts the response is 400 BadRequest",
"max_score": 8
},
{
"name": "Not found test",
"description": "A test requests a resource that does not exist and asserts the response is 404 NotFound",
"max_score": 8
},
{
"name": "Persistence round-trip test",
"description": "A test POSTs a resource then GETs it by ID, asserting the retrieved data matches what was created",
"max_score": 10
},
{
"name": "Error shape consistency test",
"description": "A test checks multiple error responses (e.g. 400 and 404) and asserts each has a consistent error message field",
"max_score": 10
},
{
"name": "FluentAssertions syntax",
"description": "All assertions use `.Should()` syntax — does NOT use Assert.Equal, Assert.True, or other assertion styles",
"max_score": 10
},
{
"name": "ReadFromJsonAsync<JsonElement>",
"description": "Response bodies are deserialized using `ReadFromJsonAsync<JsonElement>()` (not JsonSerializer.Deserialize, not strongly-typed DTOs)",
"max_score": 10
},
{
"name": "GetProperty navigation",
"description": "JSON properties are accessed using `.GetProperty(\"fieldName\")` (not via C# property binding or dynamic casting)",
"max_score": 8
},
{
"name": "PostAsJsonAsync used",
"description": "POST requests send JSON payloads using `PostAsJsonAsync` (not StringContent, not JsonContent.Create manually)",
"max_score": 8
},
{
"name": "Async Task with [Fact]",
"description": "All test methods are declared `public async Task` and decorated with `[Fact]`",
"max_score": 10
},
{
"name": "Status code FluentAssertions",
"description": "Status code assertions use `response.StatusCode.Should().Be(HttpStatusCode.XYZ)` pattern specifically",
"max_score": 10
}
]
}