コード例 #1
0
        public void GivenValidate_WhenHavingANullContent_ThenResultShouldBeInvalid()
        {
            var model     = NewCommentModelFactory.Default().WithContent(null);
            var validator = new NewCommentModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
コード例 #2
0
        public void GivenValidate_WhenHavingMoreThan1000Content_ThenResultShouldBeInvalid()
        {
            var model     = NewCommentModelFactory.Default().WithContent(new string('*', 1_001));
            var validator = new NewCommentModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
コード例 #3
0
        public void GivenValidate_WhenHavingAValidInput_ThenResultShouldBeValid()
        {
            var model     = NewCommentModelFactory.Default();
            var validator = new NewCommentModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeTrue();
            result.Errors.Count.Should().Be(0);
        }