Unit-testing with xUnit and TestContainers

Albert Starreveld
3 min readFeb 17, 2023

Some things are hard to test. Executing Stored procedures with EntityFrameworkCore for example. Stored procedures don’t work with an in-memory dbContext or with Sqlite. To test it, you’ll need a running instance of SQL Server.

Testing with dependencies on infrastructure is not ideal because it requires configuration to be similar across development machines and build agents. Containerizing the infrastructure with Docker can ease the pain.

And then there’s the issue of unit testing in general. A proper unit test has some important…

--

--

Albert Starreveld

Passionate about cloud native software development. Only by sharing knowledge and code we can take software development to the next level!