/// <summary> /// Setup the test /// </summary> public DumpTruckUnitTest() { DbContextOptions <DbAppContext> options = new DbContextOptions <DbAppContext>(); Mock <DbAppContext> dbAppContext = new Mock <DbAppContext>(null, options); DumpTruckService _service = new DumpTruckService(dbAppContext.Object); _DumpTruck = new DumpTruckController(_service); }
/// <summary> /// Setup the test /// </summary> public DumpTruckUnitTest() { DbContextOptions <DbAppContext> options = new DbContextOptions <DbAppContext>(); Mock <DbAppContext> dbAppContext = new Mock <DbAppContext>(null, options); /* * * Here you will need to mock up the context. * * ItemType fakeItem = new ItemType(...); * * Mock<DbSet<ItemType>> mockList = MockDbSet.Create(fakeItem); * * dbAppContext.Setup(x => x.ModelEndpoint).Returns(mockItem.Object); * */ DumpTruckService _service = new DumpTruckService(dbAppContext.Object); _DumpTruck = new DumpTruckController(_service); }