public void Lounge_Service_Should_Update_Lounge_Sucessfully() { //Arrange var lounge = ObjectMother.GetDefaultLounge(); var loungeCmd = ObjectMother.GetLoungeUpdateCommand(); var updated = true; _mockLoungeRepository.Setup(e => e.GetById(loungeCmd.Id)).Returns(lounge); _mockLoungeRepository.Setup(r => r.Save()).Returns(updated); //Action var updateLounge = _loungeService.Update(loungeCmd); //Assert _mockLoungeRepository.Verify(e => e.GetById(loungeCmd.Id), Times.Once); _mockLoungeRepository.Verify(r => r.Update(lounge), Times.Once); updateLounge.Should().BeTrue(); }
public IHttpActionResult Update(LoungeUpdateCommand command) { var validator = command.Validate(_service); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(_service.Update(command))); }