public void UpdateUserTest_WithCorrectData_UserTestMustBeUpdated() { var uow = new Mock <IUnitOfWork>(); UserTestService uts = new UserTestService(uow.Object); uow.Setup(x => x.UserTests.Get(It.IsAny <string>())).Returns(new UserTest()); uow.Setup(x => x.UserTests.Update(new UserTest())); uts.UpdateUserTest(new UserTestDTO()); uow.Verify(x => x.SaveAsync()); }
public void UpdateUserTest_WithInCorrectData_NotFoundExceptionMustBeThrown() { var uow = new Mock <IUnitOfWork>(); UserTestService uts = new UserTestService(uow.Object); uow.Setup(x => x.UserTests.Get(It.IsAny <string>())).Returns((UserTest)null); uow.Setup(x => x.UserTests.Update(new UserTest())); Assert.Throws <NotFoundException>(() => { uts.UpdateUserTest(new UserTestDTO()); }); }