示例#1
0
        public void IBM_LoadAndParse()
        {
            TestTaxonomy_IBM_20080226 taxonomy = new TestTaxonomy_IBM_20080226();

            int errors = 0;

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

            try
            {
                errors = 0;

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

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

                SendWarningsToConsole(taxonomy.errorList);
                SendInfoToConsole(taxonomy.ErrorList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception thrown in IBM_LoadAndParse: " + ex.Message);
            }


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

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

            ArrayList nodes = taxonomy.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 = taxonomy.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");
        }
        public void IBM_LoadAndParse()
        {
            TestTaxonomy_IBM_20080226 taxonomy = new TestTaxonomy_IBM_20080226();

            int errors = 0;

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

            try
            {
                errors = 0;

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

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

                SendWarningsToConsole(taxonomy.errorList);
                SendInfoToConsole(taxonomy.ErrorList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception thrown in IBM_LoadAndParse: " + ex.Message);
            }

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

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

            ArrayList nodes = taxonomy.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 = taxonomy.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");
        }