Пример #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>()));
 }