Exemplo n.º 1
0
        public void Test_AddCommentToGame_Body_Is_Null()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);
            CommentDTO comment = new CommentDTO() { ParentCommentId = 2, Body = null, Name = "Autor2" };
            GameDTO game = new GameDTO() { Key = "me3" };

            //act
            servise.AddCommentToGame(comment, game);
        }
Exemplo n.º 2
0
        public void Test_AddCommentToGame_Comment_Is_Null()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            servise.AddCommentToGame(null, new GameDTO());
        }
Exemplo n.º 3
0
        public void Test_DeleteComment_Id_Less_Zero()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            servise.DeleteComment(-1);
        }
Exemplo n.º 4
0
        public void Test_DeleteComment_Call_Update_IsDeleted_True()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            servise.DeleteComment(2);

            //assert
            _comments.Verify(c => c.Update(It.Is<Comment>(comment => comment.IsDeleted)), Times.Once());
        }
Exemplo n.º 5
0
        public void Test_DeleteComment_Call_Delete()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            servise.DeleteComment(1);

            //assert
            _comments.Verify( c => c.Delete(It.IsAny<Comment>()), Times.Once () );
        }
Exemplo n.º 6
0
        public void Test_CommentsAttachedToGame_Return_Right_Object()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            List<CommentDTO> commentsList = servise.CommentsAttachedToGame("me3").ToList ();

            //assert
            Assert.AreEqual(3, commentsList.Count);
            Assert.AreEqual(0, commentsList[0].CommentId);
            Assert.AreEqual(1, commentsList[1].CommentId);
            Assert.AreEqual(2, commentsList[2].CommentId);
        }
Exemplo n.º 7
0
        public void Test_CommentsAttachedToGame_Key_Is_Null()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);

            //act
            IEnumerable<CommentDTO> commentsList = servise.CommentsAttachedToGame(null);
        }
Exemplo n.º 8
0
        public void Test_AddCommentToGame_With_ParrentId()
        {
            //arrange
            CommentService servise = new CommentService(_unitOfWork.Object);
            CommentDTO comment = new CommentDTO() { ParentCommentId = 2, Body = "Text4", Name = "Autor2" };
            GameDTO game = new GameDTO() { Key = "me3" };

            //act
            servise.AddCommentToGame(comment, game);

            //assert
            _comments.Verify(c => c.Insert(It.IsAny<Comment>()), Times.Once());
        }