Пример #1
0
        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>()));
        }
Пример #2
0
        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);
        }
Пример #3
0
 public void AddAuthorComment_NullArgument_Exception()
 {
     using var commentService = new CommentService(_mockCommentRepository.Object, _mapper);
     Assert.ThrowsAsync <CustomException>(() => commentService.AddAuthorComment(null, It.IsAny <string>()));
 }