Пример #1
0
        public void GetCommentByGame_KeyValid_ReturnedListComment()
        {
            _mockUnitOfWork.Setup(m => m.Comment.Get(It.IsAny <Expression <Func <Comment, bool> > >())).Returns(new List <Comment>());
            var fakeComment = new Comment();

            commentService.AddCommentToGame(Mapper.Map <CommentDTO>(fakeComment));
            _mockUnitOfWork.Verify(m => m.Comment.Add(It.IsAny <Comment>()), Times.Once);
        }
Пример #2
0
 public HttpStatusCodeResult Newcomment(CommentViewModel item)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _commentService.AddCommentToGame(Mapper.Map <CommentDTO>(item));
             return(new HttpStatusCodeResult(HttpStatusCode.Created));
         }
         catch (ArgumentNullException e)
         {
             //_logger.Error("Try to add a null entity. Message : {e.Message}  Method : {e.TargetSite}  StackTrace : {e.StackTrace}");
             return(new HttpStatusCodeResult(400));
         }
     }
     else
     {
         return(new HttpStatusCodeResult(HttpStatusCode.NotAcceptable));
     }
 }