예제 #1
0
        public void OldMutual_LoadAndParse()
        {
            TestTaxonomy_OldMutual s = new TestTaxonomy_OldMutual();
            int errors = 0;

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

            // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases
            errors = 0;
            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, "parse failed due to bad reference loader errors");

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

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[0] as Node;

            Assert.IsNotNull(title, "title is null");
            Assert.AreEqual("Financial Highlights", title.Label, "title label is wrong");
            Assert.AreEqual(0, title.Order, "title.Order is wrong");
            Assert.AreEqual(1, title.Children.Count, "title.Children.Count is wrong");

            Node operatingPerformance = title.Children[0] as Node;

            Assert.IsNotNull(operatingPerformance, "operatingPerformance is null");
            Assert.AreEqual("Operating Performance", operatingPerformance.Label, "operatingPerformance label is wrong");
            Assert.AreEqual(0, operatingPerformance.Order, "operatingPerformance.Order is wrong");

            ArrayList children = new ArrayList();

            foreach (Node n in operatingPerformance.Children)
            {
                if (n.IsProhibited)
                {
                    continue;
                }

                children.Add(n);
            }
            // don't count the prohibited - they've been superceded (by priority) with the optional element
            Assert.AreEqual(12, children.Count, "operatingPerformance.Children.Count is wrong");

            Node distribPerShare = children[4] as Node;

            Assert.IsNotNull(distribPerShare, "distribPerShare is null");
            Assert.AreEqual("Distributions Per Share", distribPerShare.Label, "distribPerShare label is wrong");
            Assert.AreEqual(3, distribPerShare.Order, "distribPerShare.Order is wrong");

            children = new ArrayList();
            foreach (Node n in distribPerShare.Children)
            {
                if (n.IsProhibited)
                {
                    continue;
                }

                children.Add(n);
            }
            Assert.AreEqual(6, children.Count, "distribPerShare.Children.Count is wrong");

            Node distribFromGainsPerShare = children[1] as Node;

            Assert.IsNotNull(distribFromGainsPerShare, "distribFromGainsPerShare is null");
            Assert.AreEqual("Distributions From Realized and Unrealized Gains Per Share", distribFromGainsPerShare.Label, "distribFromGainsPerShare label is wrong");
            Assert.AreEqual(2, distribFromGainsPerShare.Order, "distribFromGainsPerShare.Order is wrong");
            children = new ArrayList();
            foreach (Node n in distribFromGainsPerShare.Children)
            {
                if (n.IsProhibited)
                {
                    continue;
                }

                children.Add(n);
            }
            Assert.AreEqual(4, children.Count, "distribFromGainsPerShare.Children.Count is wrong");
        }
예제 #2
0
        public void OldMutual_LoadAndParse()
        {
            TestTaxonomy_OldMutual s = new TestTaxonomy_OldMutual();
            int errors = 0;

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

            // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases
            errors = 0;
            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, "parse failed due to bad reference loader errors" );

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

            ArrayList nodes = s.GetNodesByPresentation();

            Node title = nodes[0] as Node;
            Assert.IsNotNull( title, "title is null" );
            Assert.AreEqual( "Financial Highlights", title.Label, "title label is wrong" );
            Assert.AreEqual( 0, title.Order, "title.Order is wrong" );
            Assert.AreEqual( 1, title.Children.Count, "title.Children.Count is wrong" );

            Node operatingPerformance = title.Children[0] as Node;
            Assert.IsNotNull( operatingPerformance, "operatingPerformance is null" );
            Assert.AreEqual( "Operating Performance", operatingPerformance.Label, "operatingPerformance label is wrong" );
            Assert.AreEqual( 0, operatingPerformance.Order, "operatingPerformance.Order is wrong" );

            ArrayList children = new ArrayList();
            foreach (Node n in operatingPerformance.Children)
            {
                if (n.IsProhibited) continue;

                children.Add(n);
            }
            // don't count the prohibited - they've been superceded (by priority) with the optional element
            Assert.AreEqual(12, children.Count, "operatingPerformance.Children.Count is wrong");

            Node distribPerShare = children[4] as Node;
            Assert.IsNotNull( distribPerShare, "distribPerShare is null" );
            Assert.AreEqual( "Distributions Per Share", distribPerShare.Label, "distribPerShare label is wrong" );
            Assert.AreEqual( 3, distribPerShare.Order, "distribPerShare.Order is wrong" );

            children = new ArrayList();
            foreach (Node n in distribPerShare.Children)
            {
                if (n.IsProhibited) continue;

                children.Add(n);
            }
            Assert.AreEqual(6, children.Count, "distribPerShare.Children.Count is wrong");

            Node distribFromGainsPerShare = children[1] as Node;
            Assert.IsNotNull( distribFromGainsPerShare, "distribFromGainsPerShare is null" );
            Assert.AreEqual( "Distributions From Realized and Unrealized Gains Per Share", distribFromGainsPerShare.Label, "distribFromGainsPerShare label is wrong" );
            Assert.AreEqual( 2, distribFromGainsPerShare.Order, "distribFromGainsPerShare.Order is wrong" );
            children = new ArrayList();
            foreach (Node n in distribFromGainsPerShare.Children)
            {
                if (n.IsProhibited) continue;

                children.Add(n);
            }
            Assert.AreEqual(4, children.Count, "distribFromGainsPerShare.Children.Count is wrong");
        }