Example #1
0
        [Test] public void AssertXslTransformResultsWorksWithXmlInput()
        {
            StreamReader xsl            = ValidatorTests.GetTestReader("animal.xsl");
            XmlInput     xslt           = new XmlInput(xsl);
            StreamReader xml            = ValidatorTests.GetTestReader("testAnimal.xml");
            XmlInput     xmlToTransform = new XmlInput(xml);
            XmlInput     expectedXml    = new XmlInput("<dog/>");

            XmlAssert.XslTransformResults(xslt, xmlToTransform, expectedXml);
        }
Example #2
0
        [Test] public void AssertXslTransformResultsCatchesFalsePositive()
        {
            StreamReader xsl               = ValidatorTests.GetTestReader("animal.xsl");
            XmlInput     xslt              = new XmlInput(xsl);
            StreamReader xml               = ValidatorTests.GetTestReader("testAnimal.xml");
            XmlInput     xmlToTransform    = new XmlInput(xml);
            XmlInput     expectedXml       = new XmlInput("<cat/>");
            bool         exceptionExpected = true;

            try {
                XmlAssert.XslTransformResults(xslt, xmlToTransform, expectedXml);
                exceptionExpected = false;
                Assert.Fail("Expected dog not cat!");
            } catch (AssertionException e) {
                AvoidUnusedVariableCompilerWarning(e);
                if (!exceptionExpected)
                {
                    throw e;
                }
            }
        }