dotnet-testing-advanced-testcontainers-database

Provision and tear down containerized SQL Server and PostgreSQL instances for .NET integration tests.

28|4|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-advanced-testcontainers-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-testing-advanced-testcontainers-database
Source: https://github.com/kevintsengtw/dotnet-testing-agent-skills/tree/main/skills/dotnet-testing-advanced-testcontainers-database
Command: npx skills add https://github.com/kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-advanced-testcontainers-database

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates integration testing against real databases by provisioning and tearing down containerized SQL Server and PostgreSQL instances for .NET tests.

Core Features & Use Cases

  • Containerized Real Databases: Spawns MSSQL or PostgreSQL containers via Testcontainers to validate database behaviors in a realistic environment.
  • EF Core & Dapper Testing: Enables end-to-end testing of data access layers against actual database features, including transactions and concurrency.
  • Collection Fixture for Performance: Uses shared containers across test classes to significantly reduce startup time and improve test performance.
  • SQL Script Externalization: Supports external SQL scripts to define schemas and seed data for repeatable tests.

Quick Start

  1. Ensure Docker Desktop is running and your environment has Testcontainers for .NET available.
  2. Create a test collection using the SqlServer/PostgreSql container fixture pattern described in this skill, and reference it in your tests.
  3. Run your tests with dotnet test to execute containerized database tests and validate EF Core or Dapper repositories.

Frequently Asked Questions about dotnet-testing-advanced-testcontainers-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run integration tests against real databases using Docker containers in .NET?

You can run integration tests against real databases by using .NET Testcontainers to automatically provision and tear down isolated SQL Server or PostgreSQL Docker containers during your test runs. This validates database-specific behaviors realistically.

Can I test EF Core and Dapper data layers with Testcontainers?

Yes, Testcontainers works with both EF Core and Dapper data layers. It provisions containerized SQL Server and PostgreSQL instances, enabling end-to-end validation of transactions, concurrency, and specific database features through container connection strings.

How do I reduce container startup time for database integration tests?

To reduce container startup time for database integration tests, implement a shared collection fixture pattern. This provisions a single container instance across multiple test classes, significantly improving overall test performance and execution speed.

How do I manage database schemas and seed data for repeatable Testcontainers tests?

You can manage database schemas and seed data for repeatable Testcontainers tests by externalizing SQL scripts. The Skill supports loading these external scripts to define the schema and seed initial data when the containerized database is provisioned.

Do I need Docker Desktop to run Testcontainers database tests?

Yes, Docker Desktop is required to run Testcontainers database tests. Your environment must have Docker Desktop actively running to provision and manage the SQL Server or PostgreSQL containers needed for validating your .NET data access layers.

What is the best way to test transactions and concurrency in .NET data access layers?

The best way to test transactions and concurrency in .NET data access layers is using Testcontainers to spawn real MSSQL or PostgreSQL databases. This enables testing actual database features in isolated containers rather than relying on in-memory mocks.