public ActionResult Add(ReviewViewModel userReview) { var reviewEntity = Mapper.Map <ReviewViewModel, ReviewClient>(userReview); _reviewClientService.Add(reviewEntity, User.Identity.Name); return(RedirectToAction("Get")); }
public void Add_CorrectReview_CallsCreateAndSave() { _userRepositoryMock.Setup(m => m.GetFirst(It.IsAny <Expression <Func <User, bool> > >())).Returns(new User { UserId = 1 }); _sut = new ReviewClientService(_reviewClientRepositoryMock.Object, _unitOfWorkMock.Object, _userRepositoryMock.Object); _sut.Add(new ReviewClient(), "test"); _reviewClientRepositoryMock.Verify(m => m.Create(It.IsAny <ReviewClient>()), Times.Once); _unitOfWorkMock.Verify(m => m.SaveChanges(), Times.Once); }