How to sneak a real database into a unit(ish) test

Speakers

We’ve all been there: your unit tests pass cleanly with a mocked database, but the app stumbles or crashes the moment it hits a real environment. Modern ORMs and data layers are powerful, but mocks can hide silent failures, leaving you crossing your fingers in production.

But using a real database in your test suite shouldn't mean waiting hours for builds or dealing with messy shared infrastructure.

In this talk, we’ll explore how to get the best of both worlds using Testcontainers. We’ll look at how to spin up ephemeral, containerised databases directly from your test code to run fast, "unit-ish" tests that actually validate your EF Core schemas, migrations, and LINQ queries against the real thing. You’ll walk away with actionable strategies to catch database bugs early, build confidence in your data layer, and speed up your feedback loops.

An unhandled error has occurred. Reload 🗙