System.Xml.Tests.TCXmlSchemaValidatorMisc.SchemaPatternFacetHandlesRegularExpressionsWrong C# (CSharp) 메소드

SchemaPatternFacetHandlesRegularExpressionsWrong() 개인적인 메소드

private SchemaPatternFacetHandlesRegularExpressionsWrong ( ) : void
리턴 void
        public void SchemaPatternFacetHandlesRegularExpressionsWrong()
        {
            Initialize();

            Regex regex = new Regex(@"^\w+$", RegexOptions.None);
            string schemaContent = @"<xs:schema elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='validationTest'>
<xs:simpleType>
<xs:restriction base='xs:string'><xs:pattern value='^\w+$' /></xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>";

            XmlReaderSettings rs = new XmlReaderSettings();
            rs.ValidationEventHandler += new ValidationEventHandler(ValidationCallback);
            rs.ValidationType = ValidationType.Schema;
            rs.Schemas.Add(null, XmlReader.Create(new StringReader(schemaContent)));

            using (XmlReader r = XmlReader.Create(new StringReader("<validationTest>test_test</validationTest>"), rs))
            {
                while (r.Read()) ;
            }

            Assert.Equal(warningCount, 0);
            Assert.Equal(errorCount, 1);
            return;
        }
    }