In most projects, there is a need to interact with some kind of database. There is an approach that we have a layer called repository which is responsible for saving and retrieving data from the database. Usually, we write an integration test for the repository, and to make the rest of the tests faster we use an in-memory implementation of that repository. It’s a basic concept, and almost everyone is familiar with it, so everything is clear and simple, right? Not really. In this article, I will show you how to test repositories in a way that will make your tests closer to the real behavior, which means that you will be more confident that your code works as expected.