public bool Update(UpdateGoalViewModel model) { var entity = Mapper.Map<UpdateGoalViewModel, Goal>(model); _goalRepository.Update(entity, model.Id); return true; }
public void succeed_update_goal_repository_mocked() { //arrange string goalId = "goal/1"; var model = new UpdateGoalViewModel() { Id = goalId, Name = "some new name", Description = "some new desc" }; _mockedGoalRepository.Setup(repository=>repository.Update(It.Is<Goal>(goal=>goal.Id == goalId), goalId)).Returns(true).Verifiable(); //act var result = _goalService.Update(model); //assert _mockedGoalRepository.Verify(verify => verify.Update(It.IsAny<Goal>(), goalId), Times.Once); result.Should().Be(true); }