public void v107()
{
bool found = false;
XmlSchemaSet sc = new XmlSchemaSet();
sc.XmlResolver = new XmlUrlResolver();
XmlSchema parent = sc.Add(null, Path.Combine(TestData._Root, "import_v10_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_v10_b.xsd")); // should be already present in the set
sc.Add(null, Path.Combine(TestData._Root, "import_v10_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_v10_b.xsd") && imp.Schema.TargetNamespace == null)
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_v10_c.xsd") && imp.Schema.TargetNamespace.Equals("ns-c"))
found = true;
if (!found) Assert.True(false);
// try adding no ns schema with an ns
sch_B = sc.Add("ns-b", Path.Combine(TestData._Root, "import_v10_b.xsd"));
CError.Compare(sc.Count, 4, "Count");
sc.Reprocess(sch_B);
CError.Compare(sc.IsCompiled, false, "ReprocessIsCompiled");
CError.Compare(sc.Count, 4, "ReprocessCount");
sc.Compile();
CError.Compare(sc.Count, 4, "CompileCount");
CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
return;
}