Exemplo n.º 1
0
        public void QCOM_LoadAndParse()
        {
            TestTaxonomy_QCOM_20060326 s = new TestTaxonomy_QCOM_20060326();

            int errors = 0;

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

            errors = 0;

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

            // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases
            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
            }

            SendWarningsToConsole(s.errorList);
            SendInfoToConsole(s.ErrorList);

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

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

            ArrayList nodes = s.GetNodesByCalculation();

            Node incomeStmt = nodes[3] as Node;

            Assert.IsNotNull(incomeStmt, "incomeStmt is null");
            Assert.AreEqual(3, incomeStmt.Children.Count, "wrong number of children");
            Assert.AreEqual("Income Statement", incomeStmt.Label, "node 3 wrong name");
            Assert.IsTrue(incomeStmt.ElementIsNull, "incomeStmt.MyElement is not null");

            Node netIncomeAppl = incomeStmt.Children[2] as Node;

            CheckElement(netIncomeAppl, "Net Income Applicable to Common Stockholders", 2, false);

            Node netIncome = netIncomeAppl.Children[0] as Node;

            CheckElement(netIncome, "Net income", 2, false);

            Node incomeBeforeCum = netIncome.Children[0] as Node;

            CheckElement(incomeBeforeCum, "Income/(Loss) Before Cumulative Effect of Change in Accounting Principle", 2, false);

            Node incomeBeforeEx = incomeBeforeCum.Children[0] as Node;

            CheckElement(incomeBeforeEx, "Income/(Loss) Before Extraordinary Items and Cumulative Effect of Change in Accounting Principle", 4, false);

            Node incomeLossCont = incomeBeforeEx.Children[0] as Node;

            CheckElement(incomeLossCont, "Income/(Loss) from Continuing Operations", 2, false);

            Node incomeLossContTaxes = incomeLossCont.Children[0] as Node;

            CheckElement(incomeLossContTaxes, "Income before income taxes", 3, false);

            Node operatingIncome = incomeLossContTaxes.Children[1] as Node;

            CheckElement(operatingIncome, "Operating income", 4, false);

            Node grossProfit = operatingIncome.Children[2] as Node;

            CheckElement(grossProfit, "Gross Profit", 2, false);

            Node costGoodsServicesSold = grossProfit.Children[1] as Node;

            CheckElement(costGoodsServicesSold, "Cost of equipment and services revenues", 3, true);
        }
        public void QCOM_LoadAndParse()
        {
            TestTaxonomy_QCOM_20060326 s = new TestTaxonomy_QCOM_20060326();

            int errors = 0;

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

            errors = 0;

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

            // loads the presentation linkbase for this taxonomy and merges the dependant taxonomy presentation linkbases
            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            SendWarningsToConsole( s.errorList );
            SendInfoToConsole( s.ErrorList );

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

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

            ArrayList nodes = s.GetNodesByCalculation();

            Node incomeStmt= nodes[3] as Node;
            Assert.IsNotNull( incomeStmt, "incomeStmt is null" );
            Assert.AreEqual( 3, incomeStmt.Children.Count, "wrong number of children" );
            Assert.AreEqual( "Income Statement", incomeStmt.Label, "node 3 wrong name" );
            Assert.IsTrue( incomeStmt.ElementIsNull, "incomeStmt.MyElement is not null");

            Node netIncomeAppl= incomeStmt.Children[2] as Node;
            CheckElement( netIncomeAppl, "Net Income Applicable to Common Stockholders", 2, false );

            Node netIncome = netIncomeAppl.Children[0] as Node;
            CheckElement( netIncome, "Net income", 2, false );

            Node incomeBeforeCum = netIncome.Children[0] as Node;
            CheckElement( incomeBeforeCum, "Income/(Loss) Before Cumulative Effect of Change in Accounting Principle", 2, false );

            Node incomeBeforeEx = incomeBeforeCum.Children[0] as Node;
            CheckElement( incomeBeforeEx, "Income/(Loss) Before Extraordinary Items and Cumulative Effect of Change in Accounting Principle", 4, false );

            Node incomeLossCont = incomeBeforeEx.Children[0] as Node;
            CheckElement( incomeLossCont, "Income/(Loss) from Continuing Operations", 2, false );

            Node incomeLossContTaxes = incomeLossCont.Children[0] as Node;
            CheckElement( incomeLossContTaxes, "Income before income taxes", 3, false );

            Node operatingIncome = incomeLossContTaxes.Children[1] as Node;
            CheckElement( operatingIncome, "Operating income", 4, false );

            Node grossProfit = operatingIncome.Children[2] as Node;
            CheckElement( grossProfit, "Gross Profit", 2, false );

            Node costGoodsServicesSold = grossProfit.Children[1] as Node;
            CheckElement( costGoodsServicesSold, "Cost of equipment and services revenues", 3, true );
        }