rhino

Mocking Entity Framework DbContext and IDbSet With Rhino Mocks

This is something that can take a little figuring out – using Rhino Mocks to mock a DbContext and the associated IDBSets. Because of this, I created a little generic method that helps a lot… private static IDbSet<T> GetDbSetTestDouble<T>(IList<T> data) where T : class { IQueryable<T> queryable = data.AsQueryable(); IDbSet<T> dbSet = MockRepository.GenerateMock<IDbSet<T>, IQueryable>(); dbSet.Stub(m […]