コード例 #1
0
        public void ShouldAccessStaticInstance()
        {
            // Act
            IXsdValidator xsdValidator = XsdValidator.Instance;

            // Assert
            Assert.That(xsdValidator, Is.Not.Null);
        }
コード例 #2
0
        public void ShouldAccessStaticInstance()
        {
            // Act
            IXsdValidator xsdValidator = XsdValidator.Current;

            // Assert
            xsdValidator.Should().NotBeNull();
        }
コード例 #3
0
        public void ShouldValidateXsdSchemaSuccessfully()
        {
            // Arrange
            string xmlContent = XmlTestData.GetValidXmlContent();
            string xsdContent = XmlTestData.GetXsdMarkup();

            IXsdValidator xsdValidator = XsdValidator.Instance;

            // Act
            var validationResult = xsdValidator.Validate(xmlContent, xsdContent);

            // Assert
            Assert.That(validationResult.IsValid, Is.True);
        }
コード例 #4
0
        public void ShouldFailToValidateXsdSchema()
        {
            // Arrange
            string xmlContent = XmlTestData.GetInvalidXmlContent();
            string xsdContent = XmlTestData.GetXsdMarkup();

            IXsdValidator xsdValidator = XsdValidator.Instance;

            // Act
            var validationResult = xsdValidator.Validate(xmlContent, xsdContent);

            // Assert
            Assert.That(validationResult.IsValid, Is.False);
            Assert.That(validationResult.Errors, Has.Count.EqualTo(1));
            // var meg = validationResult.Errors.ElementAt(0).Message;
        }