コード例 #1
0
        public void TestApplyXsltToSrcMLFile()
        {
            LibSrcMLRunner run = new LibSrcMLRunner();

            Assert.IsTrue(File.Exists("function_def.xml"));
            Assert.IsTrue(File.Exists("Test.xsl"));
            run.ApplyXsltToSrcMLFile("function_def.xml", "Test.xsl", "o.cpp.xml");

            SrcMLFile srcFile = new SrcMLFile("o.cpp.xml.xslout");

            Assert.IsNotNull(srcFile);

            var files = srcFile.FileUnits.ToList();

            Assert.AreEqual(1, files.Count());

            XmlReader           read             = srcFile.GetXDocument().CreateReader();
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(read.NameTable);

            namespaceManager.AddNamespace("src", "http://www.srcML.org/srcML/src");

            var persist = srcFile.GetXDocument().XPathSelectElement("//src:test", namespaceManager);

            Assert.IsNotNull(persist);
            Assert.AreEqual(persist.Value, "TestPassed");
        }