示例#1
0
        public void AddBookComment_BadArgument_Exception()
        {
            var bookCommentCreateModel = new BookCommentCreateModel
            {
                BookId  = "",
                Comment = ""
            };

            using var commentService = new CommentService(_mockCommentRepository.Object, _mapper);
            Assert.ThrowsAsync <CustomException>(() => commentService.AddBookComment(bookCommentCreateModel, It.IsAny <string>()));
        }
示例#2
0
        public void AddBookComment_GoodArgument_Success()
        {
            var bookCommentCreateModel = new BookCommentCreateModel
            {
                BookId  = "SomeBookId",
                Comment = "SomeBookComment"
            };

            using var commentService = new CommentService(_mockCommentRepository.Object, _mapper);
            var addBookComment = commentService.AddBookComment(bookCommentCreateModel, It.IsAny <string>());

            _mockCommentRepository.Verify(w => w.AddBookComment(It.IsAny <BookComment>()), Times.Once);
        }
示例#3
0
 public void AddBookComment_NullArgument_Exception()
 {
     using var commentService = new CommentService(_mockCommentRepository.Object, _mapper);
     Assert.ThrowsAsync <CustomException>(() => commentService.AddBookComment(null, It.IsAny <string>()));
 }