示例#1
0
        public ActionResult Add(ReviewViewModel userReview)
        {
            var reviewEntity = Mapper.Map <ReviewViewModel, ReviewClient>(userReview);

            _reviewClientService.Add(reviewEntity, User.Identity.Name);

            return(RedirectToAction("Get"));
        }
示例#2
0
        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);
        }