Example #1
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));
            }
        }
Example #2
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");
        }
Example #3
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");
        }
Example #4
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");
        }
Example #5
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");
        }
Example #6
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();
        }
Example #7
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");
        }
        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);
        }
        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" );
        }
        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" );
        }
        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");
        }
        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" );
        }
        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 ) );
            }
        }
        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();
        }
        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" );
        }
Example #16
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);
        }