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

AddEditInvalidIncludeSchema() private method

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

            XmlSchemaSet ss = new XmlSchemaSet();
            ss.XmlResolver = new XmlUrlResolver();
            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");

            XmlSchemaInclude inc = new XmlSchemaInclude();
            inc.SchemaLocation = "include_v2.xsd";
            Schema1.Includes.Add(inc);

            try
            {
                ss.Reprocess(Schema1);
                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;
        }