コード例 #1
0
        public async Task Comment_Content_Length_Equal_MaxLength()
        {
            // Setup
            var validator = new MaxLengthValidator(5);
            var content   = "Hello";
            var context   = new CommentContext(content);

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

            // Assert
            Assert.IsTrue(result.Successed);
        }
コード例 #2
0
        public async Task Comment_Content_Length_Longer_Than_MaxLength()
        {
            // Setup
            var validator = new MaxLengthValidator(5);
            var content   = "Hello_Hello";
            var context   = new PublicationContext(content);

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

            // Assert
            Assert.IsFalse(result.Successed);
        }
コード例 #3
0
        public async Task Publication_Content_Length_Shorter_Than_MaxLength()
        {
            // Setup
            var validator = new MaxLengthValidator(5);
            var content   = "Hi";
            var context   = new PublicationContext(content);

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

            // Assert
            Assert.IsTrue(result.Successed);
        }
コード例 #4
0
        public async Task Comment_Content_Length_Shorter_Than_MaxLength()
        {
            // Setup
            var validator = new MaxLengthValidator(5);
            var content   = "Hi";

            var comment = new Comment(string.Empty, content, DateTimeOffset.Now, string.Empty, null, null);

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

            // Assert
            Assert.IsTrue(result.Successed);
        }
コード例 #5
0
        public async Task Publication_Content_Length_Equal_MaxLength()
        {
            // Setup
            var validator = new MaxLengthValidator(5);
            var content   = "Hello";

            var publication = new Publication(
                string.Empty,
                content,
                Enumerable.Empty <string>(),
                null,
                DateTimeOffset.Now,
                DateTimeOffset.Now);

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

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