System.Xml.Tests.TCValidateAfterAddInvalidSchema.AddEditInvalidImport C# (CSharp) Method

AddEditInvalidImport() private method

private AddEditInvalidImport ( String testDir, String testFile, int expCountGT, int expCountGE ) : void
testDir String
testFile String
expCountGT int
expCountGE int
return void
        public void AddEditInvalidImport(String testDir, String testFile, int expCountGT, int expCountGE)
        {
            string xsd = Path.Combine(path, testDir, testFile);

            XmlSchemaSet ss = new XmlSchemaSet();
            XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), null);
            XmlSchema Schema1 = ss.Add(Schema);
            ValidateSchemaSet(ss, 1, false, 0, 0, 0, "Validation after add");

            ss.Compile();
            ValidateSchemaSet(ss, 1, true, expCountGT, expCountGE, 0, "Validation after add/comp");

            XmlSchemaImport imp = new XmlSchemaImport();
            imp.Namespace = "ns-a";
            imp.SchemaLocation = "reprocess_v9_a.xsd";
            Schema.Includes.Add(imp);

            try
            {
                ss.Reprocess(Schema);
                Assert.True(false);
            }
            catch (XmlSchemaException e)
            {
                _output.WriteLine(e.Message);
            }
            ValidateSchemaSet(ss, 1, false, 1, 0, 0, "Validation after repr");

            try
            {
                ss.Compile();
                Assert.True(false);
            }
            catch (XmlSchemaException e)
            {
                _output.WriteLine(e.Message);
            }
            ValidateSchemaSet(ss, 1, false, 1, 0, 0, "Validation after repr/comp");

            try
            {
                ValidateWithSchemaInfo(ss);
                Assert.True(false);
            }
            catch (XmlSchemaValidationException e)
            {
                _output.WriteLine(e.Message);
            }
            return;
        }