Entity Framework mocking requires global context
问题 I have recently began to dig into Entity Framework unit-testing with Entity Framework 6 mocking. I have noticed the following thing: Entity Framework mocking forces me to create a global context in my BL class, for example: public class RefundRepayment : IDisposable { protected DbContext _dbContext = new DbContext(); /* more properties and class code */ public void Dispose() { _dbContext.Dispose(); } } I can't quite figure it out, as I'd rather implement the using statement in every method in