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

v106() private méthode

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

            sc.Reprocess(parent);
            CError.Compare(sc.IsCompiled, false, "ReprocessIsCompiled");
            CError.Compare(sc.Count, 3, "ReprocessCount");

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

            XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v9_b.xsd")); // should be already present in the set
            sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd"));				   // should be already present in the set
            CError.Compare(sc.Count, 3, "Count");
            CError.Compare(sc.IsCompiled, true, "IsCompiled");

            sc.Reprocess(sch_B);
            CError.Compare(sc.IsCompiled, false, "ReprocessIsCompiled");
            CError.Compare(sc.Count, 3, "ReprocessCount");

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

            // check that schema is present in parent.Includes and its NS correct.
            foreach (XmlSchemaImport imp in parent.Includes)
                if (imp.SchemaLocation.Equals("import_v9_b.xsd") && imp.Schema.TargetNamespace.Equals("ns-b"))
                    found = true;
            if (!found) Assert.True(false);
            // check that schema C in sch_b.Includes and its NS correct.
            foreach (XmlSchemaImport imp in sch_B.Includes)
                if (imp.SchemaLocation.Equals("import_v9_c.xsd") && imp.Schema.TargetNamespace.Equals("ns-c"))
                    return;

            Assert.True(false);
        }