public void HIT_LoadAndParse()
        {
            TestTaxonomy_HIT_20050930 s = new TestTaxonomy_HIT_20050930();

            int errors = 0;

            if ( s.Load( HIT_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 n1 = (Node)nodes[0];
            Assert.IsTrue( n1.ElementIsNull, "n1 element is not null" );
            Assert.IsNotNull( n1.Children, "n1.children is null" );

            Node n2 = (Node)n1.Children[0];
            Assert.IsFalse( n2.ElementIsNull, "n2 element is null" );
            Assert.IsNotNull( n2.Children, "n2.children is null" );

            Node n3 = (Node)n2.Children[0];
            Assert.IsFalse( n3.ElementIsNull, "n3 element is null" );

            ArrayList nodesAgain = s.GetNodesByPresentation();

            Node n1Again = (Node)nodesAgain[0];
            Assert.IsTrue( n1Again.ElementIsNull, "n1Again element is not null" );
            Assert.IsNotNull( n1Again.Children, "n1Again.children is null" );

            Node n2Again = (Node)n1Again.Children[0];
            Assert.IsFalse( n2Again.ElementIsNull, "n2Again element is null" );
            Assert.IsNotNull( n2Again.Children, "n2Again.children is null" );

            Node n3Again = (Node)n2Again.Children[0];
            Assert.IsFalse( n3Again.ElementIsNull, "n3Again element is null" );
        }
Example #2
0
        public void HIT_LoadAndParse()
        {
            TestTaxonomy_HIT_20050930 s = new TestTaxonomy_HIT_20050930();

            int errors = 0;

            if (s.Load(HIT_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 n1 = (Node)nodes[0];

            Assert.IsTrue(n1.ElementIsNull, "n1 element is not null");
            Assert.IsNotNull(n1.Children, "n1.children is null");

            Node n2 = (Node)n1.Children[0];

            Assert.IsFalse(n2.ElementIsNull, "n2 element is null");
            Assert.IsNotNull(n2.Children, "n2.children is null");

            Node n3 = (Node)n2.Children[0];

            Assert.IsFalse(n3.ElementIsNull, "n3 element is null");

            ArrayList nodesAgain = s.GetNodesByPresentation();

            Node n1Again = (Node)nodesAgain[0];

            Assert.IsTrue(n1Again.ElementIsNull, "n1Again element is not null");
            Assert.IsNotNull(n1Again.Children, "n1Again.children is null");

            Node n2Again = (Node)n1Again.Children[0];

            Assert.IsFalse(n2Again.ElementIsNull, "n2Again element is null");
            Assert.IsNotNull(n2Again.Children, "n2Again.children is null");

            Node n3Again = (Node)n2Again.Children[0];

            Assert.IsFalse(n3Again.ElementIsNull, "n3Again element is null");
        }