Example #1
0
        public void IM_LoadAndParse()
        {
            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();
            int errors = 0;

            if (s.Load(IM_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);
            }

            Assert.AreEqual(0, errors, "parse failed");
            // 1 duplicate element

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

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

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

            Assert.AreEqual(1, parentNode.Children.Count, "wrong number of children");
        }
Example #2
0
        public void MS_RoleTest()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_MS s = new TestTaxonomy_MS();

            int errors = 0;

            if (s.Load(MS_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.LoadImports(out errors);

            Assert.AreEqual(0, errors, "load imports failed");

            // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases
            errors = 0;
            s.LoadPresentation(out errors);

//			s.Parse( out errors );
//
            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
                SendWarningsToConsole(s.errorList);
            }
            Assert.AreEqual(0, errors, "load presentation failed");

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

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

            Assert.AreEqual(0, errors, "load elements failed");

            s.BindPresentationCalculationElements(true, out errors);

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

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

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

            Assert.AreEqual(7, parentNode.Children.Count, "wrong number of children");
        }
Example #3
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");
        }
Example #4
0
        public void MS_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_MS s = new TestTaxonomy_MS();

            int errors = 0;

            if (s.Load(MS_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);
            }

            Assert.AreEqual(0, errors, "parse failed");

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

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

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

            Assert.AreEqual(7, parentNode.Children.Count, "wrong number of children");

//			parentNode.Children.Sort();
//
//			Node earningsReleaseNode = parentNode.Children[13] as Node;
//
//			string text = null;
//			earningsReleaseNode.MyElement.TryGetLabel( "en", "label", out text );
//			Assert.AreEqual( "Earnings Release", text, "TryGetLabel wrong" );
//
//			Assert.AreEqual( "Earnings Release", earningsReleaseNode.Label, "label wrong" );
//
//			Node earningsReleaseText = earningsReleaseNode.Children[0] as Node;
//
//			earningsReleaseText.TryGetLabel( "en", "label", out text );
//			Assert.AreEqual( "Earnings Release Text", text, "Earnings Release Text label is wrong" );
        }
Example #5
0
        public void Gemma_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_Gemma s = new TestTaxonomy_Gemma();

            int errors = 0;

            DateTime start = DateTime.Now;

            if (s.Load(GEMMA_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");

            DateTime end = DateTime.Now;

            Console.WriteLine("Parse Time: {0}", end - start);
            TimeSpan level = new TimeSpan(0, 0, 0, 5, 0);               // 5 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long");

            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");

            Assert.AreEqual(1, parentNode.Children.Count, "wrong number of children");
        }
Example #6
0
        public void EDGAROnline_LoadAndParsePresentation()
        {
            TestTaxonomy_EDGAROnline s = new TestTaxonomy_EDGAROnline();
            int errors = 0;

            DateTime start = DateTime.Now;

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

            errors = 0;

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

            // there should be 1 error because there's a presentation arc that would create an infinite recursion
            Assert.AreEqual(1, errors, "wrong number of errors in presentation");

            //s.ErrorList.Sort();

            Console.WriteLine(((ParserMessage)s.ErrorList[0]).Message);

            DateTime end = DateTime.Now;

            Console.WriteLine("Parse Time: {0}", end - start);
            TimeSpan level = new TimeSpan(0, 0, 0, 10, 0);                      // 10 seconds to parse

            Assert.AreEqual(9, s.presentationInfo.Count, "wrong number of presentation links");
            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/IncomeStatement"] as PresentationLink;

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

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

            Assert.AreEqual(2, parentNode.Children.Count, "wrong number of children in presentation");
            Assert.IsTrue(level > (end - start), "Parse takes too long - " + (end - start) + " seconds");
        }
Example #7
0
        public void EDGAROnline_LoadAndParseCalculation()
        {
            for (int i = 0; i < 10; i++)
            {
                TestTaxonomy_EDGAROnline s = new TestTaxonomy_EDGAROnline();
                int errors = 0;

                DateTime start = DateTime.Now;
                if (s.Load(EDGARONLINE_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);

                // there should be 2 error because there's a calculation arc that would create an infinite recursion
                Assert.AreEqual(1, errors, "wrong number of errors in calculation");

                DateTime end = DateTime.Now;
                Console.WriteLine("Parse Time: {0}", end - start);
                TimeSpan level = new TimeSpan(0, 0, 0, 10, 0);                          // 10 seconds to parse
                Assert.AreEqual(10, s.calculationInfo.Count, "wrong number of calculation links");
                PresentationLink cl = s.calculationInfo["http://www.xbrl.org/us/fr/lr/role/CashFlowOperationsDirect"] as PresentationLink;
                Assert.IsNotNull(cl, "can't get http://www.xbrl.org/us/fr/lr/role/CashFlowOperationsDirect from calculation");

                Node parentNode = cl.CreateNode("en", "label");
                Assert.AreEqual(1, parentNode.Children.Count, "wrong number of children in calculation");

                s.currentLabelRole = @"preferredLabel";
                s.currentLanguage  = @"en";
                ArrayList temp = s.GetNodesByCalculation();

                Assert.IsTrue(level > (end - start), "Parse takes too long - " + (end - start) + " seconds");
            }
        }
Example #8
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");
        }
Example #9
0
        public void FSA_5_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_FSA s = new TestTaxonomy_FSA();

            int errors = 0;

            if (s.Load(FSA_5_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");

            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");

            Assert.AreEqual(2, parentNode.Children.Count, "wrong number of children");

            parentNode.Children.Sort();

//			Node quarterlyReporting = null;
//			Node MLA002 = null;
//
//			foreach( Node node in parentNode.Children )
//			{
//				if( node.Label == "SECTION A: Balance sheet")
//				{
//					MLA002 = node;
//				}
//				else
//				{
//					quarterlyReporting = node;
//				}
//			}
            Node quarterlyReporting = parentNode.Children[1] as Node;
            Node MLA002             = quarterlyReporting.Children[0] as Node;


            Assert.AreEqual("SECTION A: Balance sheet", MLA002.Label, "Node.Label on node MLA002 wrong");

            string text = null;

            MLA002.MyElement.TryGetLabel("en", "definitionGuidance", out text);
            Assert.AreEqual(1925, text.Length, "TryGetLabel 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");
        }