Integration Tests with Entity Framework and SQLite in .NET Core
I have recently completed a new .NET core API and created a SQLite in memory database so I could do effective integration testing. Given how complex some of the linq we write is mocking it out and just saying yeah its going to return that seems pretty unreliable to me so I built an in memory database and wrote tests against it. So far we have written 120 test that create an in memory database, perform the test and then do a tear down. I takes about 2 minutes to complete everything which I think is pretty good all things considered. The snippet below shows how I setup the creation of the DbContextOptions, this is important because any data context created using this will reference the same in memory database. That's pretty cool if you think about it. Note that I am creating and disposing of one such data context in the setup. private readonly DbContextOptions _dbOptions; public TestSetup() { var optionsBuilder = new Db...