
Running Integration Tests with Docker in .NET using TestContainers
Hello everyone, in today’s post I will show you the easiest and cleanest way to perform integration testing of your code with database dependencies with the help of docker and TestContainers. Unlike unit tests where you can use In-Memory or Mock the database calls, integration tests need to test the actual calls to the database, and using an empty, In-Memory, database will not represent the reality of what the system is doing, or perhaps your code is tightly coupled with specific database behaviors or relies on certain configurations that an In-Memory setup won’t capture accurately. For that, we will use docker to run a dockerized database image and perform our tests against it. And for that, we will use TestContainers. ...