示例#1
0
        public void Given_DifferentValidatorType_When_Verifying_Then_ValidationMustFail()
        {
            // Arrange
            var otherValidator = new FakePropertyValidator();
            var verifier       = new LengthValidatorVerifier <FakeLengthValidator>(1, 10);

            // Act & Assert
            AssertExtension.Throws <XunitException>(() => verifier.Verify(otherValidator), "(wrong type)");
        }
示例#2
0
        public void Given_CorrectValidator_When_Verifying_Then_ValidationPass()
        {
            // Arrange
            var lengthValidator = new FakeLengthValidator {
                Min = 1, Max = 10
            };
            var verifier = new LengthValidatorVerifier <FakeLengthValidator>(1, 10);

            // Act & Assert
            AssertExtension.NotThrows(() => verifier.Verify(lengthValidator));
        }
示例#3
0
        public void Given_CorrectValidatorWithDifferentMaxValue_When_Verifying_Then_ValidationFail()
        {
            // Arrange
            var lengthValidator = new FakeLengthValidator {
                Min = 1, Max = 100
            };
            var verifier = new LengthValidatorVerifier <FakeLengthValidator>(1, 10);

            // Act & Assert
            AssertExtension.Throws <XunitException>(() => verifier.Verify(lengthValidator),
                                                    "(Max property)");
        }