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>())); }
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); }
public void AddBookComment_NullArgument_Exception() { using var commentService = new CommentService(_mockCommentRepository.Object, _mapper); Assert.ThrowsAsync <CustomException>(() => commentService.AddBookComment(null, It.IsAny <string>())); }