示例#1
0
        public async Task ReplyId_Is_Empty()
        {
            // Setup
            var commentsStorageMock = new Mock <ICommentsStorage>();

            var validator = new CommentReplyValidator(commentsStorageMock.Object);
            var comment   = new Comment(string.Empty, string.Empty, DateTimeOffset.Now, string.Empty, replyCommentId: null, null);

            // Act
            var result = await validator.ValidateAsync(comment);

            // Assert
            Assert.IsTrue(result.Successed);
        }
示例#2
0
        public async Task ReplyId_Is_Empty()
        {
            // Setup
            var commentsStorageMock = new Mock <ICommentsStorage>();

            var validator = new CommentReplyValidator(commentsStorageMock.Object);
            var context   = new CommentContext("Hello_Hello");

            // Act
            var result = await validator.ValidateAsync(context);

            // Assert
            Assert.IsTrue(result.Successed);
        }
示例#3
0
        public async Task ReplyId_Does_Not_Exists()
        {
            // Setup
            var commentsStorageMock = new Mock <ICommentsStorage>();

            commentsStorageMock
            .Setup(s => s.FindOneByIdAsync("replyId"))
            .ReturnsAsync(default(Comment));

            var validator = new CommentReplyValidator(commentsStorageMock.Object);
            var comment   = new Comment(string.Empty, string.Empty, DateTimeOffset.Now, string.Empty, replyCommentId: "replyId", null);

            // Act
            var result = await validator.ValidateAsync(comment);

            // Assert
            Assert.IsFalse(result.Successed);
        }
示例#4
0
        public async Task ReplyId_Does_Not_Exists()
        {
            // Setup
            var commentsStorageMock = new Mock <ICommentsStorage>();

            commentsStorageMock
            .Setup(s => s.FindOneByIdAsync("replyId"))
            .ReturnsAsync(default(Comment));

            var validator = new CommentReplyValidator(commentsStorageMock.Object);
            var context   = new CommentContext("Hello_Hello", "replyId");

            // Act
            var result = await validator.ValidateAsync(context);

            // Assert
            Assert.IsFalse(result.Successed);
        }