Monday, June 22, 2015

Need to Mock a DbSet for testing Entity Framework?

I wanted to create fast unit tests that did not rely on the database, nor data in the DB.  I used the Moq framework to create mock objects, but the Entity Framework DbSet was not easy to mock, so I created my own class.  The gist is on github.  View the readme in the gist for more details.  (One of the hardest things is to workaround the DbFunctions which only work for LINQ to Entities).

No comments:

Post a Comment