示例#1
0
        public void TestGetNodeByPath()
        {
            int numErrors;
            Taxonomy tax = new Taxonomy();
            tax.Load(@"http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd");
            tax.Parse(out numErrors);
            tax.currentLabelRole = "label";
            tax.currentLanguage = "en";

            ArrayList nodes = tax.GetNodesByPresentation(true);
            Node n = nodes[2] as Node;  //Income Statement root node
            n = n.children[0] as Node;  //Income & Expense abstarct node
            n = n.children[1] as Node;  //Cost of Goods and Services Sold
            n = n.children[1] as Node; // Cost of Services Sold
            n = n.children[5] as Node; // Cost of Services - Total

            string path = n.GetPresentationPath();
            Node testNode = tax.GetNodeFromPresentation(path, true);

            Assert.IsNotNull(testNode, "Failed to get node from presentation using path");
            Assert.AreEqual(n, testNode, "Incorrect node returned by GetNodeFromPresentation");
        }