System.Xml.Tests.TC_SchemaSet_Imports.v8 C# (CSharp) Méthode

v8() private méthode

private v8 ( ) : void
Résultat void
        public void v8()
        {
            XmlSchemaSet sc = new XmlSchemaSet();
            sc.XmlResolver = new XmlUrlResolver();
            XmlSchema parent = sc.Add(null, Path.Combine(TestData._Root, "import_v2_a.xsd"));
            CError.Compare(sc.IsCompiled, false, "AddIsCompiled");
            CError.Compare(sc.Count, 2, "AddCount");

            sc.Compile();
            CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
            CError.Compare(sc.Count, 2, "CompileCount");

            sc.Add("ns-b", Path.Combine(TestData._Root, "import_v2_b.xsd")); // should be already present in the set
            CError.Compare(sc.Count, 2, "Count");
            CError.Compare(sc.IsCompiled, true, "IsCompiled");

            // check that schema is present in parent.Includes and its NS correct.
            foreach (XmlSchemaImport imp in parent.Includes)
                if (imp.SchemaLocation.Equals("import_v2_b.xsd") && imp.Schema.TargetNamespace.Equals("ns-b"))
                    return;

            Assert.True(false);
        }