public void DeleteShoulCallSave() { var savechangesCounter = 0; var areasRepositoryFake = new Mock<IRepository<Area>>(); var dataFake = new Mock<IQmsData>(); dataFake.Setup(x => x.Areas).Returns(areasRepositoryFake.Object); dataFake.Setup(x => x.SaveChanges()).Callback(() => savechangesCounter++); var service = new AreasServices(dataFake.Object); service.Delete(1); dataFake.Verify(x => x.SaveChanges()); }
public void DeleteShoulCallDelete() { var areasRepositoryFake = new Mock<IRepository<Area>>(); var dataFake = new Mock<IQmsData>(); dataFake.Setup(x => x.Areas).Returns(areasRepositoryFake.Object); var service = new AreasServices(dataFake.Object); service.Delete(1); areasRepositoryFake.Verify(x => x.Delete(1)); }