System.Xml.Tests.TCValidateAfterRemove.v2 C# (CSharp) Method

v2() private method

private v2 ( String testDir, String testFile, int expCount, int expCountGT, int expCountGE, int expCountGA, int expCountGER, int expCountGERC ) : void
testDir String
testFile String
expCount int
expCountGT int
expCountGE int
expCountGA int
expCountGER int
expCountGERC int
return void
        public void v2(String testDir, String testFile, int expCount, int expCountGT, int expCountGE, int expCountGA, int expCountGER, int expCountGERC)
        {
            Initialize();
            string xsd = Path.Combine(path, testDir, testFile + ".xsd");
            string xml = Path.Combine(path, testDir, testFile + ".xml");

            XmlSchemaSet ss = new XmlSchemaSet();
            XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), ValidationCallback);
            ss.XmlResolver = new XmlUrlResolver();

            XmlSchema Schema1 = ss.Add(Schema);
            ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
            ValidateWithXmlReader(ss, xml, xsd);

            ss.Compile();
            ValidateSchemaSet(ss, expCount, true, expCountGT, expCountGE, expCountGA, "Validation after add/comp");
            ValidateWithXmlReader(ss, xml, xsd);

            ss.Remove(Schema);
            ValidateSchemaSet(ss, expCount - 1, false, 1, expCountGER, 0, "Validation after rem");
            ValidateWithXmlReader(ss, xml, xsd);

            ss.Compile();
            ValidateSchemaSet(ss, expCount - 1, true, expCountGERC, expCountGER, 0, "Validation after add");
            ValidateWithXmlReader(ss, xml, xsd);

            XmlSchema Schema2 = null;
            try
            {
                Schema2 = ss.Reprocess(Schema);
                Assert.True(false);
            }
            catch (ArgumentException e)
            {
                _output.WriteLine(e.Message);
            }
            ValidateSchemaSet(ss, expCount - 1, true, expCountGERC, expCountGER, 0, "Validation after repr");
            ValidateWithXmlReader(ss, xml, xsd);

            Assert.Equal(ss.RemoveRecursive(Schema), false);
            ValidateSchemaSet(ss, expCount - 1, true, expCountGERC, expCountGER, 0, "Validation after remRec");
            ValidateWithXmlReader(ss, xml, xsd);

            ss.Compile();
            ValidateSchemaSet(ss, expCount - 1, true, expCountGERC, expCountGER, 0, "Validation after remRec/comp");
            ValidateWithXmlReader(ss, xml, xsd);

            return;
        }
    }