public void ValidateReturnsBool()
            {
                var          invalidContentTestCouple = new TestGenerator.InvalidContentTestCouple();
                XmlValidator validator = new XmlValidatorTestImplementation();

                var status = validator.Validate(invalidContentTestCouple.Input());

                Assert.False(status);
            }
            public void ValidateWithInvalidContentShouldReturnFalseAndGiveValidationError()
            {
                var           invalidContentTestCouple = new TestGenerator.InvalidContentTestCouple();
                XmlValidator  validator = new XmlValidatorTestImplementation();
                List <string> messagesList;
                var           validateResult = validator.Validate(invalidContentTestCouple.Input(), out messagesList);

                Assert.True(invalidContentTestCouple.ExpectedValidationMessages.Contains(messagesList.ToString()));
                Assert.False(validateResult);
            }
            public void ValidateReturnsBoolAndOutsString()
            {
                var          invalidContentTestCouple = new TestGenerator.InvalidContentTestCouple();
                XmlValidator validator = new XmlValidatorTestImplementation();
                string       validationMessage;

                var status = validator.Validate(invalidContentTestCouple.Input(), out validationMessage);

                Assert.True(invalidContentTestCouple.ExpectedValidationMessages.Contains(validationMessage));
                Assert.False(status);
            }
示例#4
0
            public void AddsValidationMessage()
            {
                //Arrange
                var validationRunner  = new XmlValidationRunner(TestGenerator.XmlSchemaSet());
                var invalidTestCouple = new TestGenerator.InvalidContentTestCouple();

                //Act
                validationRunner.Validate(invalidTestCouple.Input());

                //Assert
                Assert.Equal(1, validationRunner.ValidationMessages.Count);
            }
            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()));
            }