public void AddAuthorComment_BadArgument_Exception() { var authorCommentCreateModel = new AuthorCommentCreateModel { AuthorId = "", Comment = "" }; using var commentService = new CommentService(_mockCommentRepository.Object, _mapper); Assert.ThrowsAsync <CustomException>(() => commentService.AddAuthorComment(authorCommentCreateModel, It.IsAny <string>())); }
public void AddAuthorComment_GoodArgument_Success() { var authorCommentCreateModel = new AuthorCommentCreateModel { AuthorId = "SomeAuthorId", Comment = "SomeAuthorComment" }; using var commentService = new CommentService(_mockCommentRepository.Object, _mapper); var addAuthorComment = commentService.AddAuthorComment(authorCommentCreateModel, It.IsAny <string>()); _mockCommentRepository.Verify(w => w.AddAuthorComment(It.IsAny <AuthorComment>()), Times.Once); }
public void AddAuthorComment_NullArgument_Exception() { using var commentService = new CommentService(_mockCommentRepository.Object, _mapper); Assert.ThrowsAsync <CustomException>(() => commentService.AddAuthorComment(null, It.IsAny <string>())); }