예제 #1
0
        public bool Update(UpdateGoalViewModel model)
        {
            var entity = Mapper.Map<UpdateGoalViewModel, Goal>(model);

            _goalRepository.Update(entity, model.Id);

            return true;
        }
예제 #2
0
        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);
        }