Esempio n. 1
0
        public void GAAP_Test_GetNodesByElement()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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));
            }
        }
Esempio n. 2
0
        public void GAAP_VerifyElementTuplesHaveChildren()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            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");
                }
            }
        }
Esempio n. 3
0
        public void GAAP_BindCalculation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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
        }
Esempio n. 4
0
        public void GAAP_ElementTaxonomyLinks()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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.currentLanguage  = "en";
            s.currentLabelRole = "terseLabel";

            ArrayList nodes = s.GetNodesByElement();

            Assert.AreEqual(1, ((Node)nodes[0]).TaxonomyInfoId, "Taxonomy id not correct");

            TaxonomyItem ti = s.GetTaxonomyInfo((Node)nodes[0]);

            Assert.AreEqual("http://www.xbrl.org/us/fr/common/pt/2004-08-15", ti.WebLocation, "target namespace wrong");

            Assert.AreEqual(@"S:\TestSchemas\XBRL 2.1 Updated\2004-08-15\usfr-pt-2004-08-15.xsd", ti.Location, "targetLocation wrong");
        }
Esempio n. 5
0
        public void GAAP_Test_VerifyTuples()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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);
            }
        }
Esempio n. 6
0
        public void Test_NoIdForElementValidation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(NO_ID);
            Assert.AreEqual(Taxonomy.ValidationStatus.WARNING, s.Validate());
        }
Esempio n. 7
0
        public void PT_GetTargetPrefix()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

            Assert.AreEqual("usfr-pt", s.GetNSPrefix());
        }
Esempio n. 8
0
        public void GAAP_LoadSchema()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            int errors = 0;

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

            s.Load(US_GAAP_FILE);

            Assert.AreEqual("us-gaap-ci", s.GetNSPrefix());
        }
Esempio n. 10
0
        public void PT_GetLinkbaseRef_Presentation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

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

            Assert.AreEqual(TestCommon.FolderRoot + @"XBRL 2.1 Updated" + System.IO.Path.DirectorySeparatorChar + "2004-08-15" + System.IO.Path.DirectorySeparatorChar + "usfr-pt-2004-08-15-presentation.xml", presRef[0]);
        }
Esempio n. 11
0
        public void GAAP_TargetNamespace()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(US_GAAP_FILE);

            s.GetTargetNamespace();

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/ci/us-gaap-ci-2004-08-15", s.targetNamespace);
        }
Esempio n. 12
0
        public void PT_TargetNamespace()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

            s.GetTargetNamespace();

            Assert.AreEqual("http://www.xbrl.org/us/fr/common/pt/2004-08-15", s.targetNamespace);
        }
Esempio n. 13
0
        public void Test_LanguageParse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            string uiLang = "en";

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

            Assert.AreEqual("en", s.CurrentLanguage, "wrong language info returned");
        }
Esempio n. 14
0
        public void GAAP_GetLinkbaseRef_Presentation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

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

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

            Assert.AreEqual(TestCommon.FolderRoot + @"XBRL 2.1 Updated" + System.IO.Path.DirectorySeparatorChar + "2004-08-15" + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2004-08-15-presentation.xml", presRef[0]);
        }
Esempio n. 15
0
        public void PT_LoadPresentationSchema()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

            int          errors = 0;
            Presentation p      = s.LoadPresentationSchema(out errors);

            Assert.IsNotNull(p);
            Assert.AreEqual(0, errors);
        }
Esempio n. 16
0
        public void GAAP_LoadImportsAndBind()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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(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-pt_AccountingPolicies"), "usfr-pt_AccountingPolicies not found");
        }
Esempio n. 17
0
        public void GAAP_ReadElements()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            int numElements = s.LoadElements(out errors);

            Assert.AreEqual(0, errors);

            Assert.AreEqual(0, s.allElements.Count);
        }
Esempio n. 18
0
        public void GAAP_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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/StatementCashFlowsDirect"] as PresentationLink;

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

            Assert.IsNotNull(pl.BaseSchema, "PresentationLink BaseSchema is null");
            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/ci/us-gaap-ci-2004-08-15/us-gaap-ci-2004-08-15.xsd", pl.BaseSchema, "BaseSchema wrong");

            PresentationLocator ploc = null;

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

            // problem with presentation linkbase - don't know the solution yet
            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

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

            Assert.IsTrue(level > (end - start), "Parse takes too long");
        }
Esempio n. 19
0
        public void GAAP_VerifyNodeOrder()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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[4] as Node;

            Assert.IsNotNull(title, "title is null");
            Assert.AreEqual("Statement of Financial Position - CI", 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");
        }
Esempio n. 20
0
        public void GAAP_VerifyProhibitedLinks()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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");
        }
Esempio n. 21
0
        public void BASI_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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);



            DateTime end = DateTime.Now;

            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
            }
            Console.WriteLine("Parse Time: {0}", end - start);

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

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

            PresentationLocator ploc = null;

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

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

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

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

            TimeSpan level     = new TimeSpan(0, 0, 0, 8, 0);           // 8 seconds to parse
            TimeSpan timeTaken = end - start;

            Assert.IsTrue(level > timeTaken, "Parse takes too long - " + timeTaken.ToString() + " seconds");
        }
Esempio n. 22
0
        public void GAAP_VerifyPresentationCorrect()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

            string rawXml = s.ToXmlString();

            s.currentLabelRole = "terseLabel";
            s.CurrentLanguage  = "en";

            ArrayList nodes = s.GetNodesByPresentation();
        }
Esempio n. 23
0
        public void GAAP_OutputTaxonomy()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

#if !AUTOMATED
            using (StreamWriter sw = new StreamWriter(US_OUT_FILE))
            {
                sw.Write(s.ToXmlString(false));
            }
#endif
        }
Esempio n. 24
0
        public void PT_ReadElements()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

            int          errors = 0;
            Presentation p      = s.LoadPresentationSchema(out errors);

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

            s.presentationInfo = p.PresentationLinks;

            s.LoadElements(out errors);
            Assert.AreEqual(0, errors, "load elements failed");
        }
Esempio n. 25
0
        public void PT_GetSupportedLanguages()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_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]);
        }
Esempio n. 26
0
        public void GAAP_VerifyPreferredLabel()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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");
        }
Esempio n. 27
0
        public void PT_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load(PT_GAAP_FILE);

            int errors = 0;

            s.Parse(out errors);

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

            Assert.AreEqual(0, errors, "errors returned");                      // presentation roleref bug in 8-15 taxonomy
            Assert.AreEqual(0, s.numWarnings, "number of warnings wrong");
        }
Esempio n. 28
0
        public void BASI_BlankElement()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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[1] as Node;

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

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

            Assert.IsNotNull(incStmt, "incStmt is null");
            Assert.IsNotNull(incStmt.Children, "incStmt.Children is null");
            Assert.AreEqual("IncomeExpensesAbstract", incStmt.Name);

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

            Assert.IsNotNull(interestExpense, "interestExpense is null");
            Assert.AreEqual("InterestExpenseAbstract", interestExpense.Name);
            Assert.IsNotNull(interestExpense.Children, "interestExpense.Children is null");

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

            Assert.IsNotNull(emptyElement, "emptyElement is null");
        }
Esempio n. 29
0
        public void GAAP_GetDependantTaxonomies()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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\2004-08-15\usfr-pt-2004-08-15.xsd", imps[0]);
        }
Esempio n. 30
0
        public void GAAP_OutputTaxonomyByNodes()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load(US_GAAP_FILE);

            s.Parse(out errors);

#if !AUTOMATED
            using (StreamWriter sw = new StreamWriter(NODE_OUT_FILE))
            {
                s.currentLanguage  = "en";
                s.currentLabelRole = "terseLabel";

                sw.Write(s.ToXmlString(s.GetNodesByPresentation()));
            }
#endif
        }
Esempio n. 31
0
        public void BASI_BlankElement()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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[1] as Node;
            Assert.IsNotNull( incStmtBasi, "incStmtBasi is null" );
            Assert.IsNotNull( incStmtBasi.Children, "incStmtBasi.Children is null" );

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

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

            Node emptyElement = interestExpense.Children[5] as Node;
            Assert.IsNotNull( emptyElement, "emptyElement is null" );
        }
Esempio n. 32
0
        public void GAAP_OutputTaxonomyByNodes()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            #if !AUTOMATED
            using ( StreamWriter sw = new StreamWriter( NODE_OUT_FILE ) )
            {
                s.currentLanguage = "en";
                s.currentLabelRole = "terseLabel";

                sw.Write( s.ToXmlString( s.GetNodesByPresentation() ) );
            }
            #endif
        }
Esempio n. 33
0
        public void GAAP_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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/StatementCashFlowsDirect"] as PresentationLink;
            Assert.IsNotNull( pl, "presentation link not found" );

            Assert.IsNotNull( pl.BaseSchema, "PresentationLink BaseSchema is null" );
            Assert.AreEqual( "http://www.xbrl.org/taxonomy/us/fr/gaap/ci/us-gaap-ci-2004-08-15/us-gaap-ci-2004-08-15.xsd", pl.BaseSchema, "BaseSchema wrong" );

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

            // problem with presentation linkbase - don't know the solution yet
            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

            TimeSpan level = new TimeSpan( 0, 0, 0, 4, 0 );	// 4 seconds to parse
            Assert.IsTrue( level > (end-start), "Parse takes too long" );
        }
Esempio n. 34
0
        public void GAAP_VerifyNodeOrder()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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[4] as Node;
            Assert.IsNotNull( title, "title is null" );
            Assert.AreEqual( "Statement of Financial Position - CI", 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" );
        }
Esempio n. 35
0
        public void Test_NoIdForElementValidation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load( NO_ID );
            Assert.AreEqual( Taxonomy.ValidationStatus.WARNING, s.Validate() );
        }
Esempio n. 36
0
        public void GAAP_TestTuples()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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);
            }
        }
Esempio n. 37
0
        public void GAAP_Test_VerifyTuples()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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 );
            }
        }
Esempio n. 38
0
        public void GAAP_GetLinkbaseRef_Presentation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

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

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

            Assert.AreEqual( TestCommon.FolderRoot + @"XBRL 2.1 Updated" +System.IO.Path.DirectorySeparatorChar +"2004-08-15" +System.IO.Path.DirectorySeparatorChar +"us-gaap-ci-2004-08-15-presentation.xml", presRef[0] );
        }
Esempio n. 39
0
        public void GAAP_TargetNamespace()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load( US_GAAP_FILE);

            s.GetTargetNamespace();

            Assert.AreEqual( "http://www.xbrl.org/taxonomy/us/fr/gaap/ci/us-gaap-ci-2004-08-15", s.targetNamespace );
        }
Esempio n. 40
0
        public void GAAP_GetDependantTaxonomies()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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\2004-08-15\usfr-pt-2004-08-15.xsd", imps[0]);
        }
Esempio n. 41
0
        public void GAAP_GetLabelRoles()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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( 6, roles.Count );
            Assert.AreEqual( "documentation", roles[0] );
            Assert.AreEqual( "label", roles[1] );
            Assert.AreEqual( "periodEndLabel", roles[2] );
            Assert.AreEqual( "periodStartLabel", roles[3] );
            Assert.AreEqual( "terseLabel", roles[4] );
            Assert.AreEqual( "totalLabel", roles[5] );
        }
Esempio n. 42
0
        public void GAAP_ElementTaxonomyLinks()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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.currentLanguage = "en";
            s.currentLabelRole = "terseLabel";

            ArrayList nodes = s.GetNodesByElement();

            Assert.AreEqual( 1, ((Node)nodes[0]).TaxonomyInfoId, "Taxonomy id not correct" );

            TaxonomyItem ti = s.GetTaxonomyInfo( (Node)nodes[0] );

            Assert.AreEqual( "http://www.xbrl.org/us/fr/common/pt/2004-08-15", ti.WebLocation, "target namespace wrong" );

            Assert.AreEqual(@"S:\TestSchemas\XBRL 2.1 Updated\2004-08-15\usfr-pt-2004-08-15.xsd", ti.Location, "targetLocation wrong");
        }
Esempio n. 43
0
        public void GAAP_BindCalculation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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
        }
Esempio n. 44
0
        public void BASI_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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 );

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

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

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

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

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

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

            TimeSpan level = new TimeSpan( 0, 0, 0, 8, 0 );	// 8 seconds to parse
            TimeSpan timeTaken = end - start;
            Assert.IsTrue(level > timeTaken, "Parse takes too long - " + timeTaken.ToString() + " seconds");
        }
Esempio n. 45
0
        public void GAAP_Parse_Label()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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-pt_RoyaltyExpense"] as Element;
            string labelString = string.Empty;
            el.TryGetLabel("en", "label", out labelString);
            Assert.IsTrue(labelString != "",  "label info is not populated");
        }
Esempio n. 46
0
        public void GAAP_GetSupportedLanguages()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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] );
        }
Esempio n. 47
0
        public void GAAP_ReadElements()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load( US_GAAP_FILE );

            int numElements = s.LoadElements( out errors );
            Assert.AreEqual( 0, errors );

            Assert.AreEqual( 0, s.allElements.Count );
        }
Esempio n. 48
0
        public void GAAP_GetTargetPrefix()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            s.Load( US_GAAP_FILE );

            Assert.AreEqual( "us-gaap-ci", s.GetNSPrefix() );
        }
Esempio n. 49
0
        public void GAAP_TestDependantPresentations()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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-pt_CommonStockShareSubscriptions", out presLocator );

            Assert.IsNotNull( presLocator, "presentation Locator not found" );
        }
Esempio n. 50
0
        public void GAAP_VerifyPreferredLabel()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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");
        }
Esempio n. 51
0
        public void GAAP_Test_GetNodesByPresentation()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            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 ) );
            }
        }
Esempio n. 52
0
        public void GAAP_VerifyPresentationCorrect()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            string rawXml = s.ToXmlString();

            s.currentLabelRole = "terseLabel";
            s.CurrentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();
        }
Esempio n. 53
0
        public void GAAP_VerifyElementTuplesHaveChildren()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            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" );
                }
            }
        }
Esempio n. 54
0
        public void GAAP_OutputTaxonomy()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            s.Load( US_GAAP_FILE);

            s.Parse( out errors );

            #if !AUTOMATED
            using ( StreamWriter sw = new StreamWriter( US_OUT_FILE ) )
            {
                sw.Write( s.ToXmlString( false ) );
            }
            #endif
        }
Esempio n. 55
0
        public void GAAP_LoadImportsAndBind()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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( 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-pt_AccountingPolicies" ), "usfr-pt_AccountingPolicies not found" );
        }
Esempio n. 56
0
        public void Test_LanguageParse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            string uiLang = "en";

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

            Assert.AreEqual( "en", s.CurrentLanguage, "wrong language info returned" );
        }
Esempio n. 57
0
        public void GAAP_VerifyPreferredLabel2()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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 );
            }

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

            // 4 - Statement of Financial Position - CI
            //     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[4] 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" );
        }
Esempio n. 58
0
        public void GAAP_LoadSchema()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();

            int errors = 0;

            Assert.AreEqual( true, s.Load( US_GAAP_FILE, out errors ), "Could not load US GAAP File" );
        }
Esempio n. 59
0
        public void GAAP_VerifyProhibitedLinks()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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" );
        }
Esempio n. 60
0
        public void Test_BASI_ProhibitedLinks()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            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.currentLanguage = "en";
            s.currentLabelRole = "label";

            ArrayList nodes = s.GetNodesByPresentation();

            Node parentNode = nodes[0] as Node;

            Assert.IsNotNull( parentNode, "node null" );
            Assert.AreEqual( "http://www.xbrl.org/2003/role/link", parentNode.Label, "label name not correct" );
            Assert.AreEqual( 5, parentNode.Children.Count, "wrong number of children" );

            Node childOne = parentNode.Children[0] as Node;

            foreach ( Node childOfChildOne in childOne.Children )
            {
                Assert.IsTrue( childOfChildOne.IsProhibited, childOfChildOne.Label + " is not prohibited" );
            }
        }