System.Xml.Tests.TCValidateElement.SanityTestsForNestedElements C# (CSharp) Méthode

SanityTestsForNestedElements() private méthode

private SanityTestsForNestedElements ( ) : void
Résultat void
        public void SanityTestsForNestedElements()
        {
            XmlSchemaValidator val;
            XmlSchemaSet schemas = new XmlSchemaSet();
            XmlSchemaInfo info = new XmlSchemaInfo();

            schemas.Add("", Path.Combine(TestData, XSDFILE_VALIDATE_END_ELEMENT));
            schemas.Compile();
            val = CreateValidator(schemas);

            val.Initialize();
            val.ValidateElement("NestedElement", "", info);
            val.ValidateEndOfAttributes(null);
            Assert.Equal(info.SchemaElement.QualifiedName, new XmlQualifiedName("NestedElement"));
            Assert.True(info.SchemaType is XmlSchemaComplexType);

            val.ValidateElement("foo", "", info);
            val.ValidateEndOfAttributes(null);
            Assert.Equal(info.SchemaElement.QualifiedName, new XmlQualifiedName("foo"));
            Assert.True(info.SchemaType is XmlSchemaComplexType);

            val.ValidateElement("bar", "", info);
            Assert.Equal(info.SchemaElement.QualifiedName, new XmlQualifiedName("bar"));
            Assert.True(info.SchemaType is XmlSchemaSimpleType);
            Assert.Equal(info.SchemaType.TypeCode, XmlTypeCode.String);

            return;
        }