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