Exemplo n.º 1
0
        public void GAAP_BindCalculation()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

            s.numWarnings = errors = 0;
            s.BindPresentationCalculationElements(false, out errors);

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

            Assert.AreEqual(0, errors, "Bind calc failed");
            Assert.AreEqual(0, s.numWarnings, "num warnings wrong");

            // 500 from pt
        }
Exemplo n.º 2
0
        public void GAAP_VerifyElementTuplesHaveChildren()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

            s.currentLabelRole = "label";
            s.currentLanguage  = "en";

            ArrayList nodes = s.GetNodesByElement();

            Assert.IsNotNull(nodes, "No nodes returned");

            foreach (Node n in nodes)
            {
                if (n.IsTuple)
                {
                    Assert.IsNotNull(n.Children, "children arraylist is null");
                    Assert.IsTrue(n.Children.Count > 0, "Tuple doesn't have children");
                    Assert.AreEqual(0.0, n.Order, "order not zero");
                }
            }
        }
Exemplo n.º 3
0
        public void GAAP_Test_GetNodesByElement()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage  = "en";

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

            ArrayList nodeList = s.GetNodesByElement();

            Assert.IsNotNull(nodeList);
            Assert.AreEqual(1367, nodeList.Count);

            Console.WriteLine("Nodes By Element: ");

            foreach (Node n in nodeList)
            {
                Console.WriteLine(TestNode.ToXml(0, n));
            }
        }
Exemplo n.º 4
0
        public void BASI_BlankElement()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            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.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node incStmtBasi = nodes[4] as Node;
            Assert.IsNotNull( incStmtBasi, "incStmtBasi is null" );

            Node incStmt = incStmtBasi.Children[0] as Node;
            Assert.IsNotNull( incStmt, "incStmt is null" );

            Node interestExpense = incStmt.Children[1] as Node;
            Assert.IsNotNull( interestExpense, "interestExpense is null" );

            Node emptyElement = interestExpense.Children[5] as Node;
            Assert.IsNotNull( emptyElement, "emptyElement is null" );
        }
Exemplo n.º 5
0
        public void GAAP_Test_VerifyTuples()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage  = "en";

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

            ArrayList nodeList = s.GetNodesByElement();

            Assert.IsNotNull(nodeList);
            Assert.AreEqual(1331, nodeList.Count);

            Console.WriteLine("Found Tuple Nodes: ");

            foreach (Node n in nodeList)
            {
                RecurseVerifyTuples(n);
            }
        }
Exemplo n.º 6
0
        public void GAAP_LoadSchema()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            int errors = 0;

            Assert.AreEqual(true, s.Load(US_GAAP_FILE, out errors), "Could not load US GAAP File");
        }
Exemplo n.º 7
0
        public void GAAP_GetTargetPrefix()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load(US_GAAP_FILE);

            Assert.AreEqual("us-gaap-ci", s.GetNSPrefix());
        }
Exemplo n.º 8
0
        public void Test_LanguageParse()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            string uiLang             = "en";

            s.CurrentLanguage = string.Empty;
            s.CurrentLanguage = uiLang;

            Assert.AreEqual("en", s.CurrentLanguage, "wrong language info returned");
        }
Exemplo n.º 9
0
        public void GAAP_TargetNamespace()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load(US_GAAP_FILE);

            s.GetTargetNamespace();

            Assert.AreEqual("http://www.xbrl.org/us/fr/gaap/ci/2005-02-28", s.targetNamespace);
        }
Exemplo n.º 10
0
        public void GAAP_GetLinkbaseRef_Presentation()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            Assert.AreEqual(true, s.Load(US_GAAP_FILE, out errors), "Could not load US GAAP File");

            string[] presRef = s.GetLinkbaseReference(TestTaxonomy_2005_02_28.TARGET_LINKBASE_URI + TestTaxonomy_2005_02_28.PRESENTATION_ROLE);

            Assert.AreEqual(US_GAAP_PRESNTATION_FILE, presRef[0]);
        }
Exemplo n.º 11
0
        public void GAAP_LoadImportsAndBind()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

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

            Assert.AreEqual(0, errors, "wrong number of load import errors");

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

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

            Assert.AreEqual(0, errors, "wrong number of load presentation errors");

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

            //Assert.AreEqual( 5, errors, "wrong number of load element errors" ); //no duplicate elements defined in the latest taxonomy
            Assert.AreEqual(0, errors, "wrong number of load element errors");
            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
            }

            errors = 0;
            s.BindPresentationCalculationElements(true, out errors);

            Assert.AreEqual(0, errors, "wrong number of bind errors");
            Assert.AreEqual(0, s.numWarnings, "wrong number of warnings");

            // accounting policies is defined in the usfr-pt schema
            Assert.IsTrue(s.allElements.ContainsKey("usfr-pte_AccountingPolicies"), "usfr-pte_AccountingPolicies not found");
        }
Exemplo n.º 12
0
        public void GAAP_ReadElements()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            int numElements = s.LoadElements(out errors);

            Assert.AreEqual(0, errors);
            Assert.AreEqual(0, s.allElements.Count);
        }
Exemplo n.º 13
0
        public void GAAP_Parse()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            DateTime start = DateTime.Now;

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

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

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

            DateTime end = DateTime.Now;

            Console.WriteLine("Parse Time: {0}", end - start);

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

            Assert.IsNotNull(pl, "presentation link not found");

            Assert.IsNotNull(pl.BaseSchema, "PresentationLink BaseSchema is null");
            Assert.AreEqual("http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd", pl.BaseSchema, "BaseSchema wrong");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pte_NetIncreaseDecreaseCashCashEquivalents", out ploc));

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

            if (s.numWarnings > 0)
            {
                Assert.AreEqual(s.numWarnings, SendWarningsToConsole(s.errorList), "numWarnings doesn't match warnings reported in the errorList");
            }

            Assert.AreEqual(0, s.numWarnings, "wrong number of warnings ");

            // 57 = bind failures - elements w/o presentation

            //Trace.Listeners.Clear();
            TimeSpan level = new TimeSpan(0, 0, 0, 5, 0);               // 5 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long - " + (end - start) + " seconds");
        }
Exemplo n.º 14
0
        public void GAAP_VerifyNodeOrder()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

            s.currentLabelRole = "label";
            s.currentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[5] as Node;

            Assert.IsNotNull(title, "title is null");
            Assert.AreEqual("Statement of Financial Position", title.Label, "title label is wrong");
            Assert.AreEqual(0, title.Order, "title.Order is wrong");

            Node statement = title.Children[0] as Node;

            Assert.IsNotNull(statement, "statement is null");
            Assert.AreEqual("Statement of Financial Position", statement.Label, "statement label is wrong");
            Assert.AreEqual(0, statement.Order, "statement.Order is wrong");
            Assert.AreEqual(2, statement.Children.Count, "statement.Children.Count is wrong");

            Node assets = statement.Children[0] as Node;

            Assert.IsNotNull(assets, "statement is null");
            Assert.AreEqual("Assets", assets.Label, "assets label is wrong");
            Assert.AreEqual(1, assets.Order, "assets.Order is wrong");
            Assert.AreEqual(3, assets.Children.Count, "assets.Children.Count is wrong");

            Node child1 = assets.Children[0] as Node;

            Assert.IsNotNull(child1, "child1 is null");
            Assert.AreEqual(1, child1.Order, "child1.Order is wrong");

            Node child2 = assets.Children[1] as Node;

            Assert.IsNotNull(child2, "child2 is null");
            Assert.AreEqual(2, child2.Order, "child2.Order is wrong");

            Node child3 = assets.Children[2] as Node;

            Assert.IsNotNull(child3, "child3 is null");
            Assert.AreEqual(3, child3.Order, "child3.Order is wrong");
        }
Exemplo n.º 15
0
        public void GAAP_VerifyProhibitedLinks()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

            s.currentLabelRole = "label";
            s.currentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            // ok - here's the hierarchy
            // 0. Statement of Cash Flows - Indirect Method - CI
            // 1. Statement of Financial Position - CI
            //    0. Tuples Abstract
            //	     0. usfr-pt_CommonStock - prohibited
            //		 1. usfr-pt_ConvertiblePreferredStock - prohibited
            //		 2. usfr-pt_NonRedeemableConvertiblePreferredStock - prohibited
            //		 3. usfr-pt_NonRedeemablePreferredStock - prohibited
            //		 4. usfr-pt_PreferredStock - prohibited
            //		 5. usfr-pt_RedeemableConvertiblePreferredStock - prohibited
            //		 6. usfr-pt_RedeemablePreferredStock - prohibited
            //		 7. usfr-pt_TreasuryStock - prohibited

            Node finPos = nodes[1] as Node;

            Assert.IsNotNull(finPos, "Statement of Financial Position - CI not found");

            Node tupleAbs = finPos.Children[0] as Node;

            Assert.IsNotNull(tupleAbs, "Tuples Abstract not found");

            // and now the test
            Assert.AreEqual(8, tupleAbs.Children.Count, "TupleAbstract has children");

            // make sure are children are prohibited
            Assert.IsTrue(((Node)tupleAbs.Children[0]).IsProhibited, "child 0 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[1]).IsProhibited, "child 1 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[2]).IsProhibited, "child 2 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[3]).IsProhibited, "child 3 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[4]).IsProhibited, "child 4 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[5]).IsProhibited, "child 5 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[6]).IsProhibited, "child 6 not prohibited");
            Assert.IsTrue(((Node)tupleAbs.Children[7]).IsProhibited, "child 7 not prohibited");
        }
Exemplo n.º 16
0
        public void GAAP_GetSupportedLanguages()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList langs = s.GetSupportedLanguages(false, out errors);

            Assert.AreEqual(0, errors);
            Assert.AreEqual(1, langs.Count);
            Assert.AreEqual("en", langs[0]);
        }
Exemplo n.º 17
0
        public void BASI_Parse()
        {
            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);
            }

            DateTime end = DateTime.Now;

            Console.WriteLine("Parse Time: {0}", end - start);

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

            Assert.IsNotNull(pl, "presentation link not found");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pte_NetIncreaseDecreaseCashCashEquivalents", out ploc));

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

            // 1 - duplicate element
            if (s.numWarnings > 0)
            {
                Assert.AreEqual(s.numWarnings, SendWarningsToConsole(s.errorList), "numWarnings doesn't match warnings reported in the errorList");
            }

            Assert.AreEqual(0, s.numWarnings, "wrong number of warnings ");

            TimeSpan level = new TimeSpan(0, 0, 0, 9, 0);               // 9 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long - " + (end - start) + " seconds");
        }
Exemplo n.º 18
0
        public void GAAP_VerifyPreferredLabel()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

            s.currentLabelRole = "preferredLabel";
            s.currentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            //0. "Statement of Cash Flows - Indirect Method - CI"
            //   0. "usfr-pt_StatementCashFlowsIndirectAbstract"
            //      ?. "usfr-pt_CashCashEquivalents"

            Node scf = nodes[0] as Node;

            Assert.IsNotNull(scf, "Statement of Cash Flows - Indirect Method - CI");

            Node scfiAbs = scf.Children[0] as Node;

            Assert.IsNotNull(scfiAbs, "Failed to find usfr-pt_StatementCashFlowsIndirectAbstract node");

            Node cce = null;

            foreach (Node node in scfiAbs.Children)
            {
                if (node.Id == "usfr-pt_CashCashEquivalents")
                {
                    cce = node;
                }
            }

            Assert.IsNotNull(cce, "Failed to find usfr-pt_CashCashEquivalents node");

            Assert.AreEqual("periodEndLabel", cce.PreferredLabel, "Invalid preferred element label");

            string label = null;

            Assert.AreEqual(true, cce.TryGetLabel(s.CurrentLanguage, s.CurrentLabelRole, out label), "Invalid return value from Node TryGetLabel method");
            Assert.AreEqual("Cash and Cash Equivalents - Ending Balance", label, "Invalid label value returned from Node TryGetLabel method");
        }
Exemplo n.º 19
0
        public void GAAP_GetDependantTaxonomies()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

            errors = 0;
            ArrayList imps = s.GetDependantTaxonomies(false, out errors);

            Assert.AreEqual(0, errors, "error list not 0");

            Assert.AreEqual(2, imps.Count, "wrong number of imports returned");

            Assert.AreEqual(@"S:\TestSchemas\XBRL 2.1 Updated\2005-02-28\usfr-ptr-2005-02-28.xsd", imps[0]);
        }
Exemplo n.º 20
0
        public void INS_VerifyNodes()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(INS_FILE);

            s.Parse(out errors);

            s.currentLabelRole = "label";
            s.currentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[3] as Node;

            Assert.IsNotNull(title, "title is null");
            Assert.AreEqual("Notes to the Financial Statements", title.Label, "title label is wrong");
            Assert.AreEqual(0, title.Order, "title.Order is wrong");
            Assert.AreEqual(3, title.Children.Count, "title.Children.Count is wrong");

            Node notes = title.Children[2] as Node;

            Assert.IsNotNull(notes, "notes is null");
            Assert.AreEqual("Notes to the Financial Statements", notes.Label, "notes label is wrong");
            Assert.AreEqual(0, notes.Order, "notes.Order is wrong");
            Assert.AreEqual(6, notes.Children.Count, "notes.Children.Count is wrong");

            Node assets = notes.Children[1] as Node;

            Assert.IsNotNull(assets, "statement is null");
            Assert.AreEqual("Asset Related Notes", assets.Label, "assets label is wrong");
            Assert.AreEqual(2, assets.Order, "assets.Order is wrong");
            Assert.AreEqual(19, assets.Children.Count, "assets.Children.Count is wrong");

            Node investments = assets.Children[5] as Node;

            Assert.IsNotNull(investments, "investments is null");
            Assert.AreEqual("Investments Note", investments.Label, "investments label is wrong");
            Assert.AreEqual(5, investments.Order, "investments.Order is wrong");
            Assert.AreEqual(10, investments.Children.Count, "investments.Children.Count is wrong");
        }
Exemplo n.º 21
0
        public void GAAP_TestTuples()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);
            s.currentLabelRole = PresentationLocator.preferredLabelRole;
            s.currentLanguage  = s.SupportedLanguages[0] as String;

            ArrayList sortedElements = s.PreProcessGetNodesByElement();

            Console.WriteLine("Found Tuple Elements: ");

            foreach (Element ele in sortedElements)
            {
                RecurseElementsForTuples(ele);
            }
        }
Exemplo n.º 22
0
        public void GAAP_GetLabelRoles()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList roles = s.GetLabelRoles(false, out errors);

            Assert.AreEqual(0, errors);
            Assert.AreEqual(8, roles.Count);
            Assert.AreEqual("documentation", roles[0]);
            Assert.AreEqual("label", roles[1]);
            Assert.AreEqual("periodEndLabel", roles[3]);
            Assert.AreEqual("periodStartLabel", roles[4]);
            Assert.AreEqual("terseLabel", roles[6]);
            Assert.AreEqual("totalLabel", roles[7]);
        }
Exemplo n.º 23
0
        public void TestTaxonomyCloneForMerging()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage  = "en";

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

            ArrayList nodeList = s.GetNodesByPresentation();

            foreach (Element ele in s.allElements.Values)
            {
                Element tmp = ele.Clone() as Element;
            }

            Taxonomy copy = s.CopyTaxonomyForMerging();
        }
Exemplo n.º 24
0
        public void BASI_BlankElement()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            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.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node incStmtBasi = nodes[4] as Node;

            Assert.IsNotNull(incStmtBasi, "incStmtBasi is null");

            Node incStmt = incStmtBasi.Children[0] as Node;

            Assert.IsNotNull(incStmt, "incStmt is null");

            Node interestExpense = incStmt.Children[1] as Node;

            Assert.IsNotNull(interestExpense, "interestExpense is null");

            Node emptyElement = interestExpense.Children[5] as Node;

            Assert.IsNotNull(emptyElement, "emptyElement is null");
        }
Exemplo n.º 25
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");
        }
Exemplo n.º 26
0
        public void GAAP_Parse_Label()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            DateTime start = DateTime.Now;

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

            errors = 0;
            s.Parse(out errors);
            DateTime end = DateTime.Now;

            Console.WriteLine("Parse Time: {0}", end - start);

            Element el          = s.allElements["usfr-pte_RoyaltyExpense"] as Element;
            string  labelString = string.Empty;

            el.TryGetLabel("en", "label", out labelString);
            Assert.IsTrue(labelString != "", "label info is not populated");
        }
Exemplo n.º 27
0
        public void GAAP_VerifyNodeOrder()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            s.currentLabelRole = "label";
            s.currentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[5] as Node;
            Assert.IsNotNull( title, "title is null" );
            Assert.AreEqual( "Statement of Financial Position", title.Label, "title label is wrong" );
            Assert.AreEqual( 0, title.Order, "title.Order is wrong" );

            Node statement = title.Children[0] as Node;
            Assert.IsNotNull( statement, "statement is null" );
            Assert.AreEqual( "Statement of Financial Position", statement.Label, "statement label is wrong" );
            Assert.AreEqual( 0, statement.Order, "statement.Order is wrong" );
            Assert.AreEqual( 2, statement.Children.Count, "statement.Children.Count is wrong" );

            Node assets = statement.Children[0] as Node;
            Assert.IsNotNull( assets, "statement is null" );
            Assert.AreEqual( "Assets", assets.Label, "assets label is wrong" );
            Assert.AreEqual( 1, assets.Order, "assets.Order is wrong" );
            Assert.AreEqual( 3, assets.Children.Count, "assets.Children.Count is wrong" );

            Node child1 = assets.Children[0] as Node;
            Assert.IsNotNull( child1, "child1 is null" );
            Assert.AreEqual( 1, child1.Order, "child1.Order is wrong" );

            Node child2 = assets.Children[1] as Node;
            Assert.IsNotNull( child2, "child2 is null" );
            Assert.AreEqual( 2, child2.Order, "child2.Order is wrong" );

            Node child3 = assets.Children[2] as Node;
            Assert.IsNotNull( child3, "child3 is null" );
            Assert.AreEqual( 3, child3.Order, "child3.Order is wrong" );
        }
Exemplo n.º 28
0
        public void GAAP_Test_VerifyTuples()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load( US_GAAP_FILE);

            int errors = 0;

            s.Parse( out errors );

            ArrayList nodeList = s.GetNodesByElement();

            Assert.IsNotNull( nodeList );
            Assert.AreEqual( 1331, nodeList.Count );

            Console.WriteLine( "Found Tuple Nodes: " );

            foreach (Node n in nodeList )
            {
                RecurseVerifyTuples( n );
            }
        }
Exemplo n.º 29
0
        public void GAAP_TestTuples()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( US_GAAP_FILE );

            s.Parse( out errors );
            s.currentLabelRole = PresentationLocator.preferredLabelRole;
            s.currentLanguage = s.SupportedLanguages[0] as String;

            ArrayList sortedElements = s.PreProcessGetNodesByElement();
            Console.WriteLine("Found Tuple Elements: ");

            foreach (Element ele in sortedElements)
            {
                RecurseElementsForTuples(ele);
            }
        }
Exemplo n.º 30
0
        public void GAAP_TargetNamespace()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load( US_GAAP_FILE);

            s.GetTargetNamespace();

            Assert.AreEqual( "http://www.xbrl.org/us/fr/gaap/ci/2005-02-28", s.targetNamespace );
        }
Exemplo n.º 31
0
        public void GAAP_Parse_Label()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );
            DateTime end = DateTime.Now;
            Console.WriteLine( "Parse Time: {0}", end-start );

            Element el = s.allElements["usfr-pte_RoyaltyExpense"] as Element;
            string labelString = string.Empty;
            el.TryGetLabel("en", "label", out labelString);
            Assert.IsTrue(labelString != "",  "label info is not populated");
        }
Exemplo n.º 32
0
        public void GAAP_VerifyTupleChildMinMaxOccurs()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

            errors = 0;
            if (s.Parse(out errors) != true)
            {
                Assert.Fail("Parse failed.");
            }

            s.CurrentLabelRole = "label";
            s.CurrentLanguage  = "en";
            ArrayList nodes = s.GetNodesByPresentation();

            // CI Presentation
            // 5 - Statement of Financial Position
            //     0 - Statement of Financial Position
            //         1 - Liabilities and Stockhoders' Equity
            //		       2 - Stockholder's Equity
            //				   1 - Preferred Stock Value
            //					   0 - Preferred Stock
            //					   3 - Redeemable Convertible Preferred Stock

            Node title = nodes[5] as Node;

            Assert.IsNotNull(title, "title is null");
            Assert.IsNotNull(title.MyPresentationLink, "presentationLink is null");

            Node statement = title.Children[0] as Node;

            Assert.IsNotNull(statement, "Statement of Financial Position is null");

            Node liabSE = statement.Children[1] as Node;

            Assert.IsNotNull(liabSE, "Liabilities and Stockhoders' Equity is null");

            Node se = liabSE.Children[2] as Node;

            Assert.IsNotNull(se, "Stockholder's Equity is null");

            Node psv = se.Children[1] as Node;

            Assert.IsNotNull(psv, "Preferred Stock Value is null");

            Node preferredStock = psv.Children[0] as Node;

            Assert.IsNotNull(preferredStock, "Preferred Stock is null");

            Node rcPreferredStock = psv.Children[3] as Node;

            Assert.IsNotNull(rcPreferredStock, "RedeemableConvertiblePreferredStock is null");

            //first check the Preferred Stock children
            //preferredStockDescription is min 1 max 1
            Node psd = preferredStock.Children[0] as Node;

            Assert.IsNotNull(psd, "PreferredStockDescription is null");
            Assert.IsNotNull(psd.MyElement, "PreferredStockDescription MyElement is null");
            Assert.AreEqual(1, psd.GetMinOccurance(), "PreferredStockDescription min value should be 1.");
            Assert.AreEqual(1, psd.GetMaxOccurance(), "PreferredStockDescription max value should be 1.");

            //preferredStockValue is min 0 max 1
            Node psvChild = preferredStock.Children[1] as Node;

            Assert.IsNotNull(psvChild, "PreferredStockValue is null");
            Assert.IsNotNull(psvChild.MyElement, "PreferredStockValue MyElement is null");
            Assert.AreEqual(0, psvChild.GetMinOccurance(), "PreferredStockValue min value should be 0.");
            Assert.AreEqual(1, psvChild.GetMaxOccurance(), "PreferredStockValue max value should be 1.");

            //now check the Redeemable Convertible Preferred Stock children
            //redeemableConvertiblePreferredStockDescription is min 1 max 1
            Node rcpsd = rcPreferredStock.Children[0] as Node;

            Assert.IsNotNull(rcpsd, "RedeemableConvertiblePreferredStockDescription is null");
            Assert.IsNotNull(rcpsd.MyElement, "RedeemableConvertiblePreferredStockDescription MyElement is null");
            Assert.AreEqual(1, rcpsd.GetMinOccurance(), "RedeemableConvertiblePreferredStockDescription min value should be 1.");
            Assert.AreEqual(1, rcpsd.GetMaxOccurance(), "RedeemableConvertiblePreferredStockDescription max value should be 1.");

            //redeemableConvertiblePreferredStockValue is min 0 max 1
            Node rcpsv = rcPreferredStock.Children[1] as Node;

            Assert.IsNotNull(rcpsv, "RedeemableConvertiblePreferredStockValue is null");
            Assert.IsNotNull(rcpsv.MyElement, "RedeemableConvertiblePreferredStockValue MyElement is null");
            Assert.AreEqual(0, rcpsv.GetMinOccurance(), "RedeemableConvertiblePreferredStockValue min value should be 0.");
            Assert.AreEqual(1, rcpsv.GetMaxOccurance(), "RedeemableConvertiblePreferredStockValue max value should be 1.");

            //redeemableConvertiblePreferredStockValueSharesSubscribedUnissued is min 0 with no max
            Node rcpsvssu = rcPreferredStock.Children[7] as Node;

            Assert.IsNotNull(rcpsvssu, "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued is null");
            Assert.IsNotNull(rcpsvssu.MyElement, "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued MyElement is null");
            Assert.AreEqual(0, rcpsvssu.GetMinOccurance(), "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued min value should be 0.");
            Assert.AreEqual(int.MaxValue, rcpsvssu.GetMaxOccurance(), "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued max value should be " + int.MaxValue);
        }
Exemplo n.º 33
0
        public void GAAP_GetTargetPrefix()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load( US_GAAP_FILE );

            Assert.AreEqual( "us-gaap-ci", s.GetNSPrefix() );
        }
Exemplo n.º 34
0
        public void GAAP_VerifyProhibitedLinks()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            s.currentLabelRole = "label";
            s.currentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            // ok - here's the hierarchy
            // 0. Statement of Cash Flows - Indirect Method - CI
            // 1. Statement of Financial Position - CI
            //    0. Tuples Abstract
            //	     0. usfr-pt_CommonStock - prohibited
            //		 1. usfr-pt_ConvertiblePreferredStock - prohibited
            //		 2. usfr-pt_NonRedeemableConvertiblePreferredStock - prohibited
            //		 3. usfr-pt_NonRedeemablePreferredStock - prohibited
            //		 4. usfr-pt_PreferredStock - prohibited
            //		 5. usfr-pt_RedeemableConvertiblePreferredStock - prohibited
            //		 6. usfr-pt_RedeemablePreferredStock - prohibited
            //		 7. usfr-pt_TreasuryStock - prohibited

            Node finPos = nodes[1] as Node;
            Assert.IsNotNull( finPos, "Statement of Financial Position - CI not found" );

            Node tupleAbs = finPos.Children[0] as Node;
            Assert.IsNotNull( tupleAbs, "Tuples Abstract not found" );

            // and now the test
            Assert.AreEqual( 8, tupleAbs.Children.Count, "TupleAbstract has children" );

            // make sure are children are prohibited
            Assert.IsTrue( ((Node)tupleAbs.Children[0]).IsProhibited, "child 0 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[1]).IsProhibited, "child 1 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[2]).IsProhibited, "child 2 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[3]).IsProhibited, "child 3 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[4]).IsProhibited, "child 4 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[5]).IsProhibited, "child 5 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[6]).IsProhibited, "child 6 not prohibited" );
            Assert.IsTrue( ((Node)tupleAbs.Children[7]).IsProhibited, "child 7 not prohibited" );
        }
Exemplo n.º 35
0
        public void GAAP_VerifyPreferredLabel2()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

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

            s.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage  = "en";

            errors = 0;
            ArrayList nodes = s.GetNodes(PresentationStyle.Presentation, false, out errors);

            Assert.AreEqual(0, errors, "errors returned from set nodes");

            // 5 - Statement of Financial Position
            //     0 - Statement of Financial Position
            //         0 - Assets
            //		       0 - Assets - Current
            //					0 - Cash, Cash Equivalents and Short Term Investments
            //						0 - Cash and Cash Equivalents

            Node stateFinPosTitle = nodes[5] as Node;

            Assert.IsNotNull(stateFinPosTitle, "stateFinPosTitle is null");
            Assert.IsNotNull(stateFinPosTitle.MyPresentationLink, "presentationLink is null");

            Node statement = stateFinPosTitle.Children[0] as Node;

            Assert.IsNotNull(statement, "statement is null");

            Node assets = statement.Children[0] as Node;

            Assert.IsNotNull(assets, "assets is null");

            Node assetsCur = assets.Children[0] as Node;

            Assert.IsNotNull(assetsCur, "assetsCur is null");

            Node cashCashEquivParent = assetsCur.Children[0] as Node;

            Assert.IsNotNull(cashCashEquivParent, "cashCashEquivParent is null");

            Node cashCashEquiv = cashCashEquivParent.Children[0] as Node;

            Assert.IsNotNull(cashCashEquiv, "cashCashEquiv is null");

            // cash, cash equiv has 3 children
            Assert.IsNotNull(cashCashEquiv.Children, "cashCashEquiv.Children is null");
            Assert.AreEqual(3, cashCashEquiv.Children.Count, "wrong number of children for cashCashEquiv");

            Node child3 = cashCashEquiv.Children[2] as Node;

            Assert.IsNotNull(child3, "child3 is null");

            //child3.PreferredLabel = null;
            child3.SetLabel("en", "preferredLabel");

            string text = null;

            child3.TryGetLabel("en", "preferredLabel", out text);

            Assert.AreEqual("totalLabel", child3.PreferredLabel, "child3.PreferredLabel is wrong");
        }
Exemplo n.º 36
0
        public void GAAP_GetLinkbaseRef_Presentation()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            Assert.AreEqual( true, s.Load( US_GAAP_FILE, out errors ), "Could not load US GAAP File" );

            string[] presRef = s.GetLinkbaseReference( TestTaxonomy_2005_02_28.TARGET_LINKBASE_URI + TestTaxonomy_2005_02_28.PRESENTATION_ROLE );

            Assert.AreEqual( US_GAAP_PRESNTATION_FILE, presRef[0] );
        }
Exemplo n.º 37
0
        public void GAAP_GetSupportedLanguages()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load( US_GAAP_FILE);

            int errors = 0;
            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList langs = s.GetSupportedLanguages(false, out errors);

            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 1, langs.Count );
            Assert.AreEqual( "en", langs[0] );
        }
Exemplo n.º 38
0
        public void GAAP_LoadSchema()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            int errors = 0;

            Assert.AreEqual( true, s.Load( US_GAAP_FILE, out errors ), "Could not load US GAAP File" );
        }
Exemplo n.º 39
0
        public void GAAP_LoadImportsAndBind()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

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

            Assert.AreEqual( 0, errors, "wrong number of load import errors" );

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

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

            Assert.AreEqual( 0, errors, "wrong number of load presentation errors" );

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

            //Assert.AreEqual( 5, errors, "wrong number of load element errors" ); //no duplicate elements defined in the latest taxonomy
            Assert.AreEqual( 0, errors, "wrong number of load element errors" );
            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            errors = 0;
            s.BindPresentationCalculationElements( true, out errors );

            Assert.AreEqual( 0, errors, "wrong number of bind errors" );
            Assert.AreEqual( 0, s.numWarnings, "wrong number of warnings" );

            // accounting policies is defined in the usfr-pt schema
            Assert.IsTrue( s.allElements.ContainsKey( "usfr-pte_AccountingPolicies" ), "usfr-pte_AccountingPolicies not found" );
        }
Exemplo n.º 40
0
        public void TestTaxonomyCloneForMerging()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load(US_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

            ArrayList nodeList = s.GetNodesByPresentation();

            foreach (Element ele in s.allElements.Values)
            {
                Element tmp = ele.Clone() as Element;
            }

            Taxonomy copy = s.CopyTaxonomyForMerging();
        }
Exemplo n.º 41
0
        public void GAAP_Parse()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

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

            DateTime end = DateTime.Now;
            Console.WriteLine( "Parse Time: {0}", end-start );

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementCashFlows"] as PresentationLink;
            Assert.IsNotNull( pl, "presentation link not found" );

            Assert.IsNotNull( pl.BaseSchema, "PresentationLink BaseSchema is null" );
            Assert.AreEqual( "http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd", pl.BaseSchema, "BaseSchema wrong" );

            PresentationLocator ploc = null;
            Assert.IsTrue( pl.TryGetLocator( "usfr-pte_NetIncreaseDecreaseCashCashEquivalents", out ploc ) );

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

            if ( s.numWarnings > 0 )
            {
                Assert.AreEqual( s.numWarnings, SendWarningsToConsole( s.errorList ), "numWarnings doesn't match warnings reported in the errorList" );
            }

            Assert.AreEqual( 0, s.numWarnings, "wrong number of warnings " );

            // 57 = bind failures - elements w/o presentation

            //Trace.Listeners.Clear();
            TimeSpan level = new TimeSpan( 0, 0, 0, 5, 0 );	// 5 seconds to parse
            Assert.IsTrue( level > (end-start), "Parse takes too long - " + (end - start) + " seconds" );
        }
Exemplo n.º 42
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" );
        }
Exemplo n.º 43
0
        public void GAAP_ReadElements()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( US_GAAP_FILE );

            int numElements = s.LoadElements( out errors );
            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 0, s.allElements.Count );
        }
Exemplo n.º 44
0
        public void Test_LanguageParse()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            string uiLang = "en";

            s.CurrentLanguage = string.Empty;
            s.CurrentLanguage = uiLang;

            Assert.AreEqual( "en", s.CurrentLanguage, "wrong language info returned" );
        }
Exemplo n.º 45
0
        public void GAAP_TestDependantPresentations()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

            s.LoadPresentation( out errors );

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

            if ( s.numWarnings > 0 )
            {
                SendWarningsToConsole( s.errorList );
                SendInfoToConsole( s.errorList );
            }

            errorList.Clear();
            errors = s.numWarnings = 0;
            s.LoadElements( out errors );

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

            if ( s.numWarnings > 0 )
            {
                SendWarningsToConsole( s.errorList );
                SendInfoToConsole( s.errorList );
            }

            // and now bind elements to presentation
            errorList.Clear();
            errors = s.numWarnings = 0;
            s.BindPresentationCalculationElements( true, out errors );

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

            if ( s.numWarnings > 0 )
            {
                SendWarningsToConsole( s.errorList );
                SendInfoToConsole( s.errorList );
            }

            // ok, now do some testing
            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementFinancialPosition"] as PresentationLink;

            Assert.IsNotNull( pl, "Presentation link is null" );

            PresentationLocator presLocator = null;
            pl.TryGetLocator( "usfr-pte_CommonStockShareSubscriptions", out presLocator );

            Assert.IsNotNull( presLocator, "presentation Locator not found" );
        }
Exemplo n.º 46
0
        public void BASI_Parse()
        {
            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 );
            }

            DateTime end = DateTime.Now;
            Console.WriteLine( "Parse Time: {0}", end-start );

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementCashFlows"] as PresentationLink;
            Assert.IsNotNull( pl, "presentation link not found" );

            PresentationLocator ploc = null;
            Assert.IsTrue( pl.TryGetLocator( "usfr-pte_NetIncreaseDecreaseCashCashEquivalents", out ploc ) );

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

            // 1 - duplicate element
            if ( s.numWarnings > 0 )
            {
                Assert.AreEqual( s.numWarnings, SendWarningsToConsole( s.errorList ), "numWarnings doesn't match warnings reported in the errorList" );
            }

            Assert.AreEqual( 0, s.numWarnings, "wrong number of warnings " );

            TimeSpan level = new TimeSpan( 0, 0, 0, 9, 0 );	// 9 seconds to parse
            Assert.IsTrue( level > (end-start), "Parse takes too long - " + (end-start) + " seconds"  );
        }
Exemplo n.º 47
0
        public void GAAP_Test_GetNodesByPresentation()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load( US_GAAP_FILE);

            int errors = 0;

            s.Parse( out errors );

            ArrayList nodeList = s.GetNodesByPresentation();

            Assert.IsNotNull( nodeList );
            Assert.AreEqual( 5, nodeList.Count );

            Console.WriteLine( "Nodes By Presentation: " );

            foreach (Node n in nodeList )
            {
                Console.WriteLine( TestNode.ToXml( 0, n ) );
            }
        }
Exemplo n.º 48
0
        public void GAAP_BindCalculation()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

            s.numWarnings = errors = 0;
            s.BindPresentationCalculationElements( false, out errors );

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

            Assert.AreEqual( 0, errors, "Bind calc failed" );
            Assert.AreEqual( 0, s.numWarnings, "num warnings wrong" );

            // 500 from pt
        }
Exemplo n.º 49
0
        public void GAAP_VerifyElementTuplesHaveChildren()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load( US_GAAP_FILE);

            int errors = 0;

            s.Parse( out errors );

            s.currentLabelRole = "label";
            s.currentLanguage = "en";

            ArrayList nodes = s.GetNodesByElement();

            Assert.IsNotNull( nodes, "No nodes returned" );

            foreach ( Node n in nodes )
            {
                if ( n.IsTuple )
                {
                    Assert.IsNotNull( n.Children, "children arraylist is null" );
                    Assert.IsTrue( n.Children.Count > 0, "Tuple doesn't have children" );
                    Assert.AreEqual( 0.0, n.Order, "order not zero" );
                }
            }
        }
Exemplo n.º 50
0
        public void GAAP_GetDependantTaxonomies()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

            errors = 0;
            ArrayList imps = s.GetDependantTaxonomies( false, out errors );
            Assert.AreEqual( 0, errors, "error list not 0" );

            Assert.AreEqual( 2, imps.Count, "wrong number of imports returned" );

            Assert.AreEqual(@"S:\TestSchemas\XBRL 2.1 Updated\2005-02-28\usfr-ptr-2005-02-28.xsd", imps[0]);
        }
Exemplo n.º 51
0
        public void GAAP_VerifyPreferredLabel()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            s.currentLabelRole = "preferredLabel";
            s.currentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            //0. "Statement of Cash Flows - Indirect Method - CI"
            //   0. "usfr-pt_StatementCashFlowsIndirectAbstract"
            //      ?. "usfr-pt_CashCashEquivalents"

            Node scf = nodes[0] as Node;
            Assert.IsNotNull( scf, "Statement of Cash Flows - Indirect Method - CI" );

            Node scfiAbs = scf.Children[0] as Node;
            Assert.IsNotNull( scfiAbs, "Failed to find usfr-pt_StatementCashFlowsIndirectAbstract node" );

            Node cce = null;
            foreach(Node node in scfiAbs.Children)
                if(node.Id == "usfr-pt_CashCashEquivalents")
                    cce = node;

            Assert.IsNotNull( cce, "Failed to find usfr-pt_CashCashEquivalents node" );

            Assert.AreEqual("periodEndLabel", cce.PreferredLabel, "Invalid preferred element label");

            string label = null;
            Assert.AreEqual(true, cce.TryGetLabel(s.CurrentLanguage, s.CurrentLabelRole, out label), "Invalid return value from Node TryGetLabel method");
            Assert.AreEqual("Cash and Cash Equivalents - Ending Balance", label, "Invalid label value returned from Node TryGetLabel method");
        }
Exemplo n.º 52
0
        public void GAAP_GetLabelRoles()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();

            s.Load( US_GAAP_FILE );

            int errors = 0;
            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList roles = s.GetLabelRoles(false, out errors);

            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 8, roles.Count );
            Assert.AreEqual( "documentation", roles[0] );
            Assert.AreEqual( "label", roles[1] );
            Assert.AreEqual( "periodEndLabel", roles[3] );
            Assert.AreEqual( "periodStartLabel", roles[4] );
            Assert.AreEqual( "terseLabel", roles[6] );
            Assert.AreEqual( "totalLabel", roles[7] );
        }
Exemplo n.º 53
0
        public void GAAP_VerifyPreferredLabel2()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

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

            s.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage = "en";

            errors = 0;
            ArrayList nodes = s.GetNodes(PresentationStyle.Presentation, false, out errors );

            Assert.AreEqual( 0, errors, "errors returned from set nodes" );

            // 5 - Statement of Financial Position
            //     0 - Statement of Financial Position
            //         0 - Assets
            //		       0 - Assets - Current
            //					0 - Cash, Cash Equivalents and Short Term Investments
            //						0 - Cash and Cash Equivalents

            Node stateFinPosTitle = nodes[5] as Node;
            Assert.IsNotNull( stateFinPosTitle, "stateFinPosTitle is null" );
            Assert.IsNotNull( stateFinPosTitle.MyPresentationLink, "presentationLink is null" );

            Node statement = stateFinPosTitle.Children[0] as Node;
            Assert.IsNotNull( statement , "statement is null" );

            Node assets = statement.Children[0] as Node;
            Assert.IsNotNull( assets, "assets is null" );

            Node assetsCur = assets.Children[0] as Node;
            Assert.IsNotNull( assetsCur, "assetsCur is null" );

            Node cashCashEquivParent = assetsCur.Children[0] as Node;
            Assert.IsNotNull( cashCashEquivParent, "cashCashEquivParent is null" );

            Node cashCashEquiv = cashCashEquivParent.Children[0] as Node;
            Assert.IsNotNull( cashCashEquiv, "cashCashEquiv is null" );

            // cash, cash equiv has 3 children
            Assert.IsNotNull( cashCashEquiv.Children, "cashCashEquiv.Children is null" );
            Assert.AreEqual( 3, cashCashEquiv.Children.Count, "wrong number of children for cashCashEquiv" );

            Node child3 = cashCashEquiv.Children[2] as Node;

            Assert.IsNotNull( child3, "child3 is null" );

            //child3.PreferredLabel = null;
            child3.SetLabel( "en", "preferredLabel" );

            string text = null;
            child3.TryGetLabel( "en", "preferredLabel", out text );

            Assert.AreEqual( "totalLabel", child3.PreferredLabel, "child3.PreferredLabel is wrong" );
        }
Exemplo n.º 54
0
        public void INS_VerifyNodes()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            s.Load( INS_FILE);

            s.Parse( out errors );

            s.currentLabelRole = "label";
            s.currentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[3] as Node;
            Assert.IsNotNull( title, "title is null" );
            Assert.AreEqual( "Notes to the Financial Statements", title.Label, "title label is wrong" );
            Assert.AreEqual( 0, title.Order, "title.Order is wrong" );
            Assert.AreEqual( 3, title.Children.Count, "title.Children.Count is wrong" );

            Node notes = title.Children[2] as Node;
            Assert.IsNotNull( notes, "notes is null" );
            Assert.AreEqual( "Notes to the Financial Statements", notes.Label, "notes label is wrong" );
            Assert.AreEqual( 0, notes.Order, "notes.Order is wrong" );
            Assert.AreEqual( 6, notes.Children.Count, "notes.Children.Count is wrong" );

            Node assets = notes.Children[1] as Node;
            Assert.IsNotNull( assets, "statement is null" );
            Assert.AreEqual( "Asset Related Notes", assets.Label, "assets label is wrong" );
            Assert.AreEqual( 2, assets.Order, "assets.Order is wrong" );
            Assert.AreEqual( 19, assets.Children.Count, "assets.Children.Count is wrong" );

            Node investments = assets.Children[5] as Node;
            Assert.IsNotNull( investments, "investments is null" );
            Assert.AreEqual( "Investments Note", investments.Label, "investments label is wrong" );
            Assert.AreEqual( 5, investments.Order, "investments.Order is wrong" );
            Assert.AreEqual( 10, investments.Children.Count, "investments.Children.Count is wrong" );
        }
Exemplo n.º 55
0
        public void GAAP_VerifyTupleChildMinMaxOccurs()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

            errors = 0;
            if ( s.Parse(out errors ) != true )
            {
                Assert.Fail( "Parse failed." );
            }

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";
            ArrayList nodes = s.GetNodesByPresentation();

            // CI Presentation
            // 5 - Statement of Financial Position
            //     0 - Statement of Financial Position
            //         1 - Liabilities and Stockhoders' Equity
            //		       2 - Stockholder's Equity
            //				   1 - Preferred Stock Value
            //					   0 - Preferred Stock
            //					   3 - Redeemable Convertible Preferred Stock

            Node title = nodes[5] as Node;
            Assert.IsNotNull( title, "title is null" );
            Assert.IsNotNull( title.MyPresentationLink, "presentationLink is null" );

            Node statement = title.Children[0] as Node;
            Assert.IsNotNull( statement , "Statement of Financial Position is null" );

            Node liabSE = statement.Children[1] as Node;
            Assert.IsNotNull( liabSE, "Liabilities and Stockhoders' Equity is null" );

            Node se = liabSE.Children[2] as Node;
            Assert.IsNotNull( se, "Stockholder's Equity is null" );

            Node psv = se.Children[1] as Node;
            Assert.IsNotNull( psv, "Preferred Stock Value is null" );

            Node preferredStock = psv.Children[0] as Node;
            Assert.IsNotNull( preferredStock, "Preferred Stock is null" );

            Node rcPreferredStock = psv.Children[3] as Node;
            Assert.IsNotNull( rcPreferredStock, "RedeemableConvertiblePreferredStock is null" );

            //first check the Preferred Stock children
            //preferredStockDescription is min 1 max 1
            Node psd= preferredStock.Children[0] as Node;
            Assert.IsNotNull( psd, "PreferredStockDescription is null" );
            Assert.IsNotNull( psd.MyElement, "PreferredStockDescription MyElement is null" );
            Assert.AreEqual(1, psd.GetMinOccurance(), "PreferredStockDescription min value should be 1.");
            Assert.AreEqual(1, psd.GetMaxOccurance(), "PreferredStockDescription max value should be 1.");

            //preferredStockValue is min 0 max 1
            Node psvChild= preferredStock.Children[1] as Node;
            Assert.IsNotNull( psvChild, "PreferredStockValue is null" );
            Assert.IsNotNull( psvChild.MyElement, "PreferredStockValue MyElement is null" );
            Assert.AreEqual(0, psvChild.GetMinOccurance(), "PreferredStockValue min value should be 0.");
            Assert.AreEqual(1, psvChild.GetMaxOccurance(), "PreferredStockValue max value should be 1.");

            //now check the Redeemable Convertible Preferred Stock children
            //redeemableConvertiblePreferredStockDescription is min 1 max 1
            Node rcpsd= rcPreferredStock.Children[0] as Node;
            Assert.IsNotNull( rcpsd, "RedeemableConvertiblePreferredStockDescription is null" );
            Assert.IsNotNull( rcpsd.MyElement, "RedeemableConvertiblePreferredStockDescription MyElement is null" );
            Assert.AreEqual(1, rcpsd.GetMinOccurance(), "RedeemableConvertiblePreferredStockDescription min value should be 1.");
            Assert.AreEqual(1, rcpsd.GetMaxOccurance(), "RedeemableConvertiblePreferredStockDescription max value should be 1.");

            //redeemableConvertiblePreferredStockValue is min 0 max 1
            Node rcpsv= rcPreferredStock.Children[1] as Node;
            Assert.IsNotNull( rcpsv, "RedeemableConvertiblePreferredStockValue is null" );
            Assert.IsNotNull( rcpsv.MyElement, "RedeemableConvertiblePreferredStockValue MyElement is null" );
            Assert.AreEqual(0, rcpsv.GetMinOccurance(), "RedeemableConvertiblePreferredStockValue min value should be 0.");
            Assert.AreEqual(1, rcpsv.GetMaxOccurance(), "RedeemableConvertiblePreferredStockValue max value should be 1.");

            //redeemableConvertiblePreferredStockValueSharesSubscribedUnissued is min 0 with no max
            Node rcpsvssu = rcPreferredStock.Children[7] as Node;
            Assert.IsNotNull( rcpsvssu, "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued is null" );
            Assert.IsNotNull( rcpsvssu.MyElement, "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued MyElement is null" );
            Assert.AreEqual(0, rcpsvssu.GetMinOccurance(), "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued min value should be 0.");
            Assert.AreEqual(int.MaxValue, rcpsvssu.GetMaxOccurance(), "RedeemableConvertiblePreferredStockValueSharesSubscribedUnissued max value should be " + int.MaxValue);
        }
Exemplo n.º 56
0
        public void GAAP_TestDependantPresentations()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

            s.LoadPresentation(out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            errorList.Clear();
            errors = s.numWarnings = 0;
            s.LoadElements(out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            // and now bind elements to presentation
            errorList.Clear();
            errors = s.numWarnings = 0;
            s.BindPresentationCalculationElements(true, out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            // ok, now do some testing
            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementFinancialPosition"] as PresentationLink;

            Assert.IsNotNull(pl, "Presentation link is null");

            PresentationLocator presLocator = null;

            pl.TryGetLocator("usfr-pte_CommonStockShareSubscriptions", out presLocator);

            Assert.IsNotNull(presLocator, "presentation Locator not found");
        }