Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created March 31, 2015 06:56
Show Gist options
  • Save johnmmoss/92d79a681ba8f38e8d2b to your computer and use it in GitHub Desktop.
Save johnmmoss/92d79a681ba8f38e8d2b to your computer and use it in GitHub Desktop.
Entity Framework Mock DbContext
ITimesheetsContext _context = MockRepository.GenerateStub<ITimesheetsContext>();
_context.Departments = new TestDbSet<Department>();
_context.Timesheets = new TestDbSet<Timesheet>();
_context.Employees = new TestDbSet<Employee>();
_context.Stub(c => c.SaveChangesAsync()).Return(Task.FromResult(0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment