コード例 #1
0
        public void PFS_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_CA_GAAP_PFS s = new TestTaxonomy_CA_GAAP_PFS();

            int errors = 0;

            if (s.Load(CA_GAAP_PFS_FILE, out errors) != true)
            {
                Assert.Fail((string)s.ErrorList[0]);
            }

            errors = 0;

            // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases
            s.Parse(out errors);

            // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases
            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.ErrorList);
            }

            // duplicate elements
            Assert.AreEqual(0, errors, "parse failed due to bad reference loader errors");

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/2003/role/link"] as PresentationLink;

            Assert.IsNotNull(pl, "can't get http://www.xbrl.org/role/link");

            Node parentNode = pl.CreateNode("en", "label");

            System.Text.StringBuilder sb = TestTaxonomy_EDGAROnline.DisplayNode(parentNode, 0);
            Console.WriteLine(sb.ToString());
            Assert.AreEqual(2, parentNode.Children.Count, "wrong number of children");

            // these names don't match the data they contain
            Node quarterlyReporting = parentNode.Children[1] as Node;
            Node MLA002             = quarterlyReporting.Children[0] as Node;

            Assert.AreEqual("Balance Sheet", MLA002.Label, "Node.Label on node MLA002 wrong");

            string references = null;

            Assert.IsTrue(MLA002.TryGetReferences(out references), "could not get references for MLA002");
            Assert.IsNotNull(references, "references is null");
        }
コード例 #2
0
        public void BASI_LabelTest()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            DateTime start = DateTime.Now;

            if (s.Load(BASI_FILE, out errors) != true)
            {
                Assert.Fail((string)s.ErrorList[0]);
            }

            errors = 0;
            s.Parse(out errors);

            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
            }

            s.BindPresentationCalculationElements(true, out errors);
            s.BindElements(new BindElementDelegate(s.BindLabelToElement), out errors);

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/TupleContentModelsCommonTerms"] as PresentationLink;

            Assert.IsNotNull(pl, "can't get http://www.xbrl.org/us/fr/lr/role/TupleContentModelsCommonTerms");

            Node parentNode = pl.CreateNode("en", "label");

            System.Text.StringBuilder sb = TestTaxonomy_EDGAROnline.DisplayNode(parentNode, 0);
            Console.WriteLine(sb.ToString());

            // test the fourth child
            Node n = (Node)parentNode.Children[13];

            Assert.AreEqual(n.Label, "Contingencies - Possible Loss", "label wrong");
        }