コード例 #1
0
            public void ValidateWithInvalidSyntaxShouldReturnFalseAndGiveValidationError()
            {
                var           invalidSyntaxTestRequest = new TestGenerator.InvalidSyntaxTestCouple();
                XmlValidator  validator = new XmlValidatorTestImplementation();
                List <string> messagesList;

                var validateResult = validator.Validate(invalidSyntaxTestRequest.Input(), out messagesList);

                Assert.True(invalidSyntaxTestRequest.ExpectedValidationMessages.Contains(messagesList.ToString()));
                Assert.False(validateResult);
            }
コード例 #2
0
            public void MultipleValidateShouldNotHoldValidationState()
            {
                XmlValidator validator = new XmlValidatorTestImplementation();

                var           invalidContentTestCouple = new TestGenerator.InvalidContentTestCouple();
                List <string> messagesList;
                var           validateResult = validator.Validate(invalidContentTestCouple.Input(), out messagesList);

                Assert.False(validateResult);
                Assert.True(invalidContentTestCouple.ExpectedValidationMessages.Contains(messagesList.ToString()));

                var validTestCouple = new TestGenerator.ValidTestCouple();

                validateResult = validator.Validate(validTestCouple.Input(), out messagesList);
                Assert.True(validateResult);
                Assert.Equal(0, messagesList.Count);

                var invalidSyntaxTestCouple = new TestGenerator.InvalidSyntaxTestCouple();

                validateResult = validator.Validate(invalidSyntaxTestCouple.Input(), out messagesList);
                Assert.False(validateResult);
                Assert.True(invalidSyntaxTestCouple.ExpectedValidationMessages.Contains(messagesList.ToString()));
            }