コード例 #1
0
            public void ValidateReturnsBool()
            {
                var          invalidContentTestCouple = new TestGenerator.InvalidContentTestCouple();
                XmlValidator validator = new XmlValidatorTestImplementation();

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

                Assert.False(status);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            public void ValidateWithCorrectXmlShouldReturnTrueAndGiveNoValidationMessages()
            {
                var           validTestCouple = new TestGenerator.ValidTestCouple();
                XmlValidator  validator       = new XmlValidatorTestImplementation();
                List <string> messagesList;

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

                Assert.True(validateResult);
                Assert.Equal(0, messagesList.Count);
            }
コード例 #4
0
            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);
            }
コード例 #5
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()));
            }