Exemple #1
0
        public void Successful(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            var result = indirectSut.Validate(validInstance);

            result.IsValid.Should().Be(true);
        }
Exemple #2
0
        public void InvalidExclusiveBetween(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.ExclusiveBetween = 0;

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidExclusiveBetween).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidExclusiveBetween.ToString());
        }
Exemple #3
0
        public void InvalidEqual(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.Equal = "asd";

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidEqual).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidEqual.ToString());
        }
Exemple #4
0
        public void InvalidNull(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.Null = "definetely not null";

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidNull).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidNull.ToString());
        }
Exemple #5
0
        public void InvalidNotEmpty(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.NotEmpty = string.Empty;

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidNotEmpty).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidNotEmpty.ToString());
        }
Exemple #6
0
        public void InvalidMatches2(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.Matches2 = "-*";

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidMatches).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidMatches.ToString());
        }
Exemple #7
0
        public void InvalidLessThanOrEqualTo(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.LessThanOrEqualTo = 1001;

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidLessThanOrEqualTo).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidLessThanOrEqualTo.ToString());
        }
Exemple #8
0
        public void InvalidIsInEnum(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.IsInEnum = (FakeEnum)(-1);

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidIsInEnum).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidIsInEnum.ToString());
        }
Exemple #9
0
        public void InvalidGreaterThan(
            FakeClass validInstance,
            AbstractValidator <FakeClass> indirectSut)
        {
            validInstance.GreaterThan = -5;

            var result = indirectSut.Validate(validInstance);

            result.Errors[0].ErrorCode.Should()
            .Be(((int)FakeErrors.InvalidGreaterThan).ToString());
            result.Errors[0].ErrorMessage.Should()
            .Be(FakeErrors.InvalidGreaterThan.ToString());
        }