csharpfritz/discord-minecraft/aspire-integration-testing
Claude Code and agent skill by csharpfritz/discord-minecraft
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Patterns for integration testing Aspire-hosted .NET services with WebApplicationFactory, Testcontainers, and SQLite
Install
npx vskill@latest install csharpfritz/discord-minecraft/aspire-integration-testingSKILL.md
Context
When writing integration tests for .NET Aspire services that use AddNpgsqlDbContext and AddRedisClient (or similar Aspire component methods). Applies to any service using Aspire 13.x with PostgreSQL + Redis.
Patterns
- Use
WebApplicationFactory<Program>to host the service under test — avoids Aspire AppHost orchestration in tests - Aspire component methods (
AddNpgsqlDbContext,AddRedisClient) validate connection strings at registration time — provide fake connection strings viabuilder.UseSetting("ConnectionStrings:name", "...")inConfigureWebHost - Swap Npgsql for SQLite in-memory by removing ALL EF Core and Npgsql service descriptors (match by
FullNamecontaining"EntityFramework","Npgsql","DbContext") then re-registering withAddDbContext<T>(o => o.UseSqlite(...)) - SQLite in-memory with
Cache=Sharedrequires a keep-aliveSqliteConnectionthat stays open for the entire fixture lifetime - Create the schema via
EnsureCreatedAsync()during fixture initialization, before the host starts - Use Testcontainers Redis for real pub/sub testing — mocking
ISubscriber.OnMessagecallbacks is brittle - Implement
IAsyncLifetimeon the factory class for container lifecycle (note: xUnitIAsyncLifetimeusesTask, notValueTask) - Use
IClassFixture<BridgeApiFactory>to share the factory across tests in a class — avoids container churn
Examples
Anti-Patterns
- Don't use
DefaultIfEmpty(value).MaxAsync()— SQLite provider can't translate it - Don't forget to provide connection strings before Aspire components register — they validate eagerly
- Don't use
BuildServiceProvider()insideConfigureServicesto callEnsureCreated()— it creates a separate DI container with stale registrations - Don't close the SQLite keep-alive connection before the test host shuts down — the in-memory database disappears
- Don't try to partially remove Npgsql services — EF Core detects multiple providers if any Npgsql registrations remain
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.ai-team/skills/aspire-integration-testing/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/csharpfritz/discord-minecraft/aspire-integration-testing)