presentation-integration-tests
Skill13 starsChanged 10 days agoMITView on GitHub
How this GraphQL API is tested end to end with WebApplicationFactory - the GraphQLApplication host, one app and database per test class, sending queries and mutations over HTTP, reading data and errors with typed test models, the schema snapshot, and testing with authentication on. Use when writing or fixing a test in tests/Presentation.Tests.Integration.
4 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- LeanMeanCleanApps/CleanLambdaFunctiontheir own version, first seen Nov 15, 2026
- LeanMeanCleanApps/CleanWebApiedited, first seen Nov 15, 2026
- LeanMeanCleanApps/CleanMinimalApiedited, first seen Nov 15, 2026
- LeanMeanCleanApps/CleanModelContextProtocoledited, first seen Nov 8, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- LeanMeanCleanApps/CleanMinimalApi★ 40013% same
- LeanMeanCleanApps/CleanWebApi★ 413% same
- LeanMeanCleanApps/CleanModelContextProtocol★ 112% same
Wrote their own version · 1
- LeanMeanCleanApps/CleanLambdaFunction★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-a-use-caseSkill
- api-conventionsSkill
- branches-and-pull-requestsSkill
- cancellationSkill
- ci-for-your-solutionSkill
- ci-pipelineSkill
- clean-architecture-layersSkill
- configuration-and-environmentsSkill
- coverageSkill
- csharp-house-styleSkill
- data-access-ef-coreSkill
- database-migrationsSkill
- dataloadersSkill
- docker-and-composeSkill
- docs-and-voiceSkill
- errors-and-exceptionsSkill
- expose-a-use-caseSkill
- family-syncSkill
- health-checksSkill
- integration-testsSkill
- mapping-with-mapperlySkill
- mediatorSkill
- nitroSkill
- optional-token-authSkill
- packages-and-dependenciesSkill
- pagingSkill
- releasesSkill
- sample-dataSkill
- schema-snapshotSkill
- security-findingsSkill
- serilogSkill
- telemetrySkill
- template-authoringSkill
- test-designSkill
- time-providerSkill
- unit-testsSkill
- validationSkill
- writing-a-skillSkill
- xml-docs-and-openapiSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Put the test in GraphQL/<Feature>/<Feature>Tests.cs with private readonly GraphQLApplication application = new().
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Presentation integration tests (GraphQL)
The rule
The GraphQL layer is tested through HTTP in tests/Presentation.Tests.Integration. ApplicationErrorFilter, PageExtensions and, with authentication, AuthenticationSettings are also tested on their own in tests/Presentation.Tests.Unit (unit-tests). GraphQLApplication (a WebApplicationFactory<Program>) starts the app with the local environment, its own shared-cache in-memory SQLite database and the sample data on. Each test class creates one in a field, implements IDisposable and disposes it, so no class shares data with another.
| Piece | Where | Use it to |
GraphQLApplication(environment, settings, configureServices) | GraphQLApplication.cs | Start the app, with other settings or services when needed |
Deserialize<T>(), ToStringContent() | Serializer.cs | Read a response into a test model, and send a query with variables as JSON |
GraphData, Data, Error, Connection<T> | GraphQL/Common/ | The shape of a GraphQL response: data and errors |
| Per-feature models | GraphQL/<Feature>/ | The fields a test asks for |
Steps
- Put the test in
GraphQL/<Feature>/<Feature>Tests.cswithprivate readonly GraphQLApplication application = new();and theDisposepattern from the other classes. - Queries can go in the URL (
/graphql?query={...}). Mutations and anything with variables are POSTed as{ query, variables }withToStringContent(). - A GraphQL response is
200 OKeven when it has errors. Assert the status, thenerrorsordata. - For failures, assert
errors[0].extensions.code(VALIDATION,NOT_FOUND) and the messages (api-conventions). - Find rows through the API (list, then pick one), not by hard-coded ids.
- A schema change also updates the snapshot (
schema-snapshot). - In a solution with authentication, its tests pass
Authentication:*settings and a test signing key. SeeAuthentication/AuthenticationTests.cs.
Example
// tests/Presentation.Tests.Integration/GraphQL/Movies/MovieTests.cs
public class MovieTests : IDisposable
{
private readonly GraphQLApplication application = new();
[Fact]
public async Task Movies_ShouldReturn_MoviesList()
{
// Arrange
using var client = this.application.CreateClient();
// Act
using var response = await client.GetAsync("/graphql?query={movies(first:50){nodes{id,title,reviewCount,averageStars,reviews{id,stars,author{id,firstName,lastName}}}}}");
var result = (await response.Content.ReadAsStringAsync()).Deserialize<GraphData>();
// Assert
response.StatusCode.ShouldBe(HttpStatusCode.OK);
result.Data.Movies.Nodes.Length.ShouldBe(50);
}
}Don't
- Share an application across tests with a
staticfield or a class fixture. - Assert only the status code. It's 200 for errors too.
- Edit appsettings files for a test. Pass
settings. - Depend on order the query doesn't promise.
Check
dotnet test tests/Presentation.Tests.IntegrationDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

