Ejemplo n.º 1
0
        public void ADBE_LoadAndParse()
        {
            TestTaxonomy_ADBE_20060901 s = new TestTaxonomy_ADBE_20060901();

            int errors = 0;

            if (s.Load(ADBE_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.GetNodesByPresentation();

            Node statements = nodes[5] as Node;

            Assert.IsNotNull(statements, "statements is null");
            Assert.AreEqual("Statement of Financial Position", statements.Label, "node 4 wrong name");
            Assert.IsTrue(statements.ElementIsNull, "statements.MyElement is not null");

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

            Assert.IsNotNull(statement, "statement is null");
            Assert.IsFalse(statement.ElementIsNull, "statement.MyElement is null");

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

            Assert.IsNotNull(assets, "assets is null");
            Assert.AreEqual(8, assets.Children.Count, "assets has wrong number of children");

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

            Assert.IsNotNull(assetsCurrent, "assetsCurrent is null");
            Assert.AreEqual(18, assetsCurrent.Children.Count, "assetsCurrent has wrong number of children");

            Node deferredIncomeTaxes = assetsCurrent.Children[5] as Node;

            Assert.IsNotNull(deferredIncomeTaxes, "deferredIncomeTaxes is null");
            Assert.IsFalse(deferredIncomeTaxes.IsProhibited, "deferredIncomeTaxes is prohibited");

            Node prohDeferredIncomeTaxes = assetsCurrent.Children[12] as Node;

            Assert.IsNotNull(prohDeferredIncomeTaxes, "proh deferredIncomeTaxes is null");
            Assert.IsTrue(prohDeferredIncomeTaxes.IsProhibited, "proh deferredIncomeTaxes is not prohibited");

            // and check one that's working
            Node propplantequip = assets.Children[4] as Node;

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

            Assert.IsNotNull(propplantequip.IsProhibited, "propplantequip is null");

            Assert.IsFalse(deferredIncomeTaxes.IsProhibited, "deferredIncomeTaxes is prohibited");

            // try and get again
            ArrayList nodesAgain = s.GetNodesByPresentation();

            Node statementsAgain = nodesAgain[5] as Node;

            Assert.IsNotNull(statementsAgain, "statementsAgain is null");
            Assert.AreEqual("Statement of Financial Position", statementsAgain.Label, "statementsAgain node 4 wrong name");
            Assert.IsTrue(statementsAgain.ElementIsNull, "statementsAgain.MyElement is not null");

            Node statementAgain = statementsAgain.Children[0] as Node;

            Assert.IsNotNull(statementAgain, "statementAgain is null");
            Assert.IsFalse(statementAgain.ElementIsNull, "statementAgain.MyElement is null");

            Node assetsAgain = statementAgain.Children[0] as Node;

            Assert.IsNotNull(assetsAgain, "assets is null");
            Assert.AreEqual(8, assetsAgain.Children.Count, "assets has wrong number of children");
            Assert.IsFalse(assetsAgain.ElementIsNull, "assetsAgain.MyElement is null");

//	this may be correct - commented out until we figure out how things should work
//
//			string text = null;
//			cashcashequiv.TryGetLabel( "en", "preferredLabel", out text );
//			Assert.AreEqual( "Cash and Cash Equivalents", text, "cashcasheqiv label incorrect" );
//
//			Assert.AreEqual( "Cash and Cash Equivalents", cashcashequiv.Label, "cashcasheqiv label incorrect" );

//			Node acctReceiveNet = assets.Children[1] as Node;
//
//			acctReceiveNet.MyElement.PreferredLabel = null;
//			acctReceiveNet.SetLabel( "en", "preferredLabel" );
//			acctReceiveNet.TryGetLabel( "en", "preferredLabel", out text );
//			Assert.AreEqual( "Dues receivable, net of allowance of $12,445 and $2,500", text, "acctReceiveNet label incorrect" );
//
//			Assert.IsNotNull( acctReceiveNet, "acctReceiveNet is null" );
//			Assert.AreEqual( "Dues receivable, net of allowance of $12,445 and $2,500", acctReceiveNet.Label, "acctRecieveNet.Label is wrong" );
        }
        public void ADBE_LoadAndParse()
        {
            TestTaxonomy_ADBE_20060901 s = new TestTaxonomy_ADBE_20060901();

            int errors = 0;

            if ( s.Load( ADBE_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.GetNodesByPresentation();

            Node statements = nodes[5] as Node;
            Assert.IsNotNull( statements, "statements is null" );
            Assert.AreEqual( "Statement of Financial Position", statements.Label, "node 4 wrong name" );
            Assert.IsTrue( statements.ElementIsNull, "statements.MyElement is not null");

            Node statement = statements.Children[0] as Node;
            Assert.IsNotNull( statement, "statement is null" );
            Assert.IsFalse( statement.ElementIsNull, "statement.MyElement is null");

            Node assets = statement.Children[0] as Node;
            Assert.IsNotNull( assets, "assets is null" );
            Assert.AreEqual( 8, assets.Children.Count, "assets has wrong number of children" );

            Node assetsCurrent = assets.Children[0] as Node;
            Assert.IsNotNull( assetsCurrent, "assetsCurrent is null" );
            Assert.AreEqual( 18, assetsCurrent.Children.Count, "assetsCurrent has wrong number of children" );

            Node deferredIncomeTaxes = assetsCurrent.Children[5] as Node;
            Assert.IsNotNull( deferredIncomeTaxes, "deferredIncomeTaxes is null" );
            Assert.IsFalse( deferredIncomeTaxes.IsProhibited, "deferredIncomeTaxes is prohibited" );

            Node prohDeferredIncomeTaxes = assetsCurrent.Children[12] as Node;
            Assert.IsNotNull( prohDeferredIncomeTaxes, "proh deferredIncomeTaxes is null" );
            Assert.IsTrue( prohDeferredIncomeTaxes.IsProhibited, "proh deferredIncomeTaxes is not prohibited" );

            // and check one that's working
            Node propplantequip = assets.Children[4] as Node;
            Assert.IsNotNull( propplantequip, "propplantequip is null" );

            Assert.IsNotNull( propplantequip.IsProhibited, "propplantequip is null" );

            Assert.IsFalse( deferredIncomeTaxes.IsProhibited, "deferredIncomeTaxes is prohibited" );

            // try and get again
            ArrayList nodesAgain = s.GetNodesByPresentation();

            Node statementsAgain = nodesAgain[5] as Node;
            Assert.IsNotNull( statementsAgain, "statementsAgain is null" );
            Assert.AreEqual( "Statement of Financial Position", statementsAgain.Label, "statementsAgain node 4 wrong name" );
            Assert.IsTrue( statementsAgain.ElementIsNull, "statementsAgain.MyElement is not null");

            Node statementAgain = statementsAgain.Children[0] as Node;
            Assert.IsNotNull( statementAgain, "statementAgain is null" );
            Assert.IsFalse( statementAgain.ElementIsNull, "statementAgain.MyElement is null");

            Node assetsAgain = statementAgain.Children[0] as Node;
            Assert.IsNotNull( assetsAgain, "assets is null" );
            Assert.AreEqual( 8, assetsAgain.Children.Count, "assets has wrong number of children" );
            Assert.IsFalse( assetsAgain.ElementIsNull, "assetsAgain.MyElement is null");

            //	this may be correct - commented out until we figure out how things should work
            //
            //			string text = null;
            //			cashcashequiv.TryGetLabel( "en", "preferredLabel", out text );
            //			Assert.AreEqual( "Cash and Cash Equivalents", text, "cashcasheqiv label incorrect" );
            //
            //			Assert.AreEqual( "Cash and Cash Equivalents", cashcashequiv.Label, "cashcasheqiv label incorrect" );

            //			Node acctReceiveNet = assets.Children[1] as Node;
            //
            //			acctReceiveNet.MyElement.PreferredLabel = null;
            //			acctReceiveNet.SetLabel( "en", "preferredLabel" );
            //			acctReceiveNet.TryGetLabel( "en", "preferredLabel", out text );
            //			Assert.AreEqual( "Dues receivable, net of allowance of $12,445 and $2,500", text, "acctReceiveNet label incorrect" );
            //
            //			Assert.IsNotNull( acctReceiveNet, "acctReceiveNet is null" );
            //			Assert.AreEqual( "Dues receivable, net of allowance of $12,445 and $2,500", acctReceiveNet.Label, "acctRecieveNet.Label is wrong" );
        }