Entity Framework 6 Test Doubles 

I’ve returned to Entity Framework 6 recently, having spent a while in and amongst the muck and bullets of carving my own SQL commands. I’m building a new cross platform mobile app using Xamarin with an Azure WebAPI App back-end and I really want to test my data access classes. EF7 comes with a handy in memory provider that can be uses for unit tests but EF6 doesn’t.

However, if you go to the Microsoft EF6 repository on GitHub (https://github.com/aspnet/EntityFramework6) all the classes you need are there. I’ve pulled them out into a discrete library that I can simply reference. It didn’t take long and it seems to work a treat, although I haven’t done much testing yet. If anybody wants to save a bit of time, I’ve put the project up on my own GitHub repository.

You can find it here https://github.com/russellg59/EF6TestDoubles.

I’ve added a few comments to stop my Resharper whinging but otherwise the code is pretty much as Microsoft wrote it. I’ll maintain it there as I use it, and I’ll test it more as I go but right now it seems to work for the simple testing that I’ve done.