Пример #1
0
        public void GAAP_VerifyPreferredLabel2()
        {
            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;
            s.Parse( out errors );

            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
                //SendWarningsToConsole( 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" );

            // 5 - Statement of Financial Position
            //     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[5] 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" );
        }
Пример #2
0
        public void GAAP_VerifyPreferredLabel2()
        {
            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;
            s.Parse(out errors);

            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
                //SendWarningsToConsole( 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");

            // 5 - Statement of Financial Position
            //     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[5] 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");
        }