How do I go about unit testing with Entity Framework and Moq?
问题 I'm new to Moq, and wanting to use it like a backing store for data - but without touching the live database. My setup is as follows: A UnitOfWork contains all repositories, and is used for data access throughout the application. A Repository represents a direct hook into a DbSet, provided by a DbContext. A DbContext contains all DbSets. Here is my test so far: // ARRANGE var user = new User() { FirstName = "Some", LastName = "Guy", EmailAddress = "some.guy@mockymoqmoq.com", }; var mockSet =