예제 #1
0
        public void CBSO_TestOneTupleChildWithMultipleParents()
        {
            //load and parse
            TestTaxonomy_CBSO s = new TestTaxonomy_CBSO();
            int errors          = 0;

            s.Load(CBSO_04_07_FILE);
            s.Parse(out errors);

            Assert.IsNotNull(s, "failed to load and parse taxonomy");

            //CBSO has three tuples that contain the same child (cbso-rf_IdentificationCode)

            // find MostImportantAssociateConsolidated - it's a tuple that has 5 children
            Node MIAC = new Node(s.allElements["cbso-rf_MostImportantAssociateConsolidated"] as Element);

            Assert.IsNotNull(MIAC, "can't find cbso-rf_MostImportantAssociateConsolidated");
            Assert.AreEqual(5, MIAC.MyElement.TupleChildren.Count, "wrong number of children in cbso-rf_MostImportantAssociateConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            bool found = false;

            foreach (Element ec in MIAC.MyElement.TupleChildren.GetValueList())
            {
                if (ec.Id == "cbso-rf_IdentificationCode")
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue(found, "could not find IdentificationCode in cbso-rf_MostImportantAssociateConsolidated");

            //verify each child element has the correct parent
            foreach (Element ec in MIAC.MyElement.TupleChildren.GetValueList())
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MIAC.AddChild(n);

                if (n.Parent.Id.CompareTo("cbso-rf_MostImportantAssociateConsolidated") != 0)
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantAssociateConsolidated as its parent");
                }
            }

            // find MostImportantJointVentureConsolidated - it's a tuple that has 4 children
            Node MIJVC = new Node(s.allElements["cbso-rf_MostImportantJointVentureConsolidated"] as Element);

            Assert.IsNotNull(MIJVC, "cbso-rf_MostImportantJointVentureConsolidated");
            Assert.AreEqual(4, MIJVC.MyElement.TupleChildren.Count, "wrong number of children in cbso-rf_MostImportantJointVentureConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            found = false;
            foreach (Element ec in MIJVC.MyElement.TupleChildren.GetValueList())
            {
                if (ec.Id == "cbso-rf_IdentificationCode")
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue(found, "could not find IdentificationCode in cbso-rf_MostImportantJointVentureConsolidated");

            //verify each child element has the correct parent
            foreach (Element ec in MIJVC.MyElement.TupleChildren.GetValueList())
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MIJVC.AddChild(n);

                if (n.Parent.Id.CompareTo("cbso-rf_MostImportantJointVentureConsolidated") != 0)
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantJointVentureConsolidated as its parent");
                }
            }

            // find MostImportantSubsidiaryConsolidated - it's a tuple that has 5 children
            Node MISC = new Node(s.allElements["cbso-rf_MostImportantSubsidiaryConsolidated"] as Element);

            Assert.IsNotNull(MISC, "can't find cbso-rf_MostImportantSubsidiaryConsolidated");
            Assert.AreEqual(5, MISC.MyElement.TupleChildren.Count, "wrong number of children in cbso-rf_MostImportantSubsidiaryConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            found = false;
            foreach (Element ec in MISC.MyElement.TupleChildren.GetValueList())
            {
                if (ec.Id == "cbso-rf_IdentificationCode")
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue(found, "could not find IdentificationCode in cbso-rf_MostImportantAssociateConsolidated");

            //verify each child element has the correct parent
            foreach (Element ec in MISC.MyElement.TupleChildren.GetValueList())
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MISC.AddChild(n);

                if (n.Parent.Id.CompareTo("cbso-rf_MostImportantSubsidiaryConsolidated") != 0)
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantSubsidiaryConsolidated as its parent");
                }
            }
        }
예제 #2
0
        public void CBSO_TestOneTupleChildWithMultipleParents()
        {
            //load and parse
            TestTaxonomy_CBSO s = new TestTaxonomy_CBSO();
            int errors = 0;

            s.Load( CBSO_04_07_FILE );
            s.Parse( out errors );

            Assert.IsNotNull(s,"failed to load and parse taxonomy");

            //CBSO has three tuples that contain the same child (cbso-rf_IdentificationCode)

            // find MostImportantAssociateConsolidated - it's a tuple that has 5 children
            Node MIAC = new Node (s.allElements[ "cbso-rf_MostImportantAssociateConsolidated" ] as Element);
            Assert.IsNotNull( MIAC, "can't find cbso-rf_MostImportantAssociateConsolidated" );
            Assert.AreEqual(5,MIAC.MyElement.TupleChildren.Count,"wrong number of children in cbso-rf_MostImportantAssociateConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            bool found = false;
            foreach ( Element ec in MIAC.MyElement.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "cbso-rf_IdentificationCode" )
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue( found, "could not find IdentificationCode in cbso-rf_MostImportantAssociateConsolidated" );

            //verify each child element has the correct parent
            foreach ( Element ec in MIAC.MyElement.TupleChildren.GetValueList() )
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MIAC.AddChild(n);

                if ( n.Parent.Id.CompareTo("cbso-rf_MostImportantAssociateConsolidated") != 0 )
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantAssociateConsolidated as its parent");
                }
            }

            // find MostImportantJointVentureConsolidated - it's a tuple that has 4 children
            Node MIJVC = new Node(s.allElements[ "cbso-rf_MostImportantJointVentureConsolidated" ] as Element);
            Assert.IsNotNull( MIJVC, "cbso-rf_MostImportantJointVentureConsolidated" );
            Assert.AreEqual(4,MIJVC.MyElement.TupleChildren.Count,"wrong number of children in cbso-rf_MostImportantJointVentureConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            found = false;
            foreach ( Element ec in MIJVC.MyElement.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "cbso-rf_IdentificationCode" )
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue( found, "could not find IdentificationCode in cbso-rf_MostImportantJointVentureConsolidated" );

            //verify each child element has the correct parent
            foreach ( Element ec in MIJVC.MyElement.TupleChildren.GetValueList() )
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MIJVC.AddChild(n);

                if ( n.Parent.Id.CompareTo("cbso-rf_MostImportantJointVentureConsolidated") != 0 )
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantJointVentureConsolidated as its parent");
                }
            }

            // find MostImportantSubsidiaryConsolidated - it's a tuple that has 5 children
            Node MISC = new Node(s.allElements[ "cbso-rf_MostImportantSubsidiaryConsolidated" ] as Element);
            Assert.IsNotNull( MISC, "can't find cbso-rf_MostImportantSubsidiaryConsolidated" );
            Assert.AreEqual(5,MISC.MyElement.TupleChildren.Count,"wrong number of children in cbso-rf_MostImportantSubsidiaryConsolidated");

            //confirm this tuple contains cbso-rf_IdentificationCode
            found = false;
            foreach ( Element ec in MISC.MyElement.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "cbso-rf_IdentificationCode" )
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue( found, "could not find IdentificationCode in cbso-rf_MostImportantAssociateConsolidated" );

            //verify each child element has the correct parent
            foreach ( Element ec in MISC.MyElement.TupleChildren.GetValueList() )
            {
                //create a node from the element and set it's parent node
                Node n = new Node(ec);
                MISC.AddChild(n);

                if ( n.Parent.Id.CompareTo("cbso-rf_MostImportantSubsidiaryConsolidated") != 0 )
                {
                    Assert.Fail(ec.Id + " does not have cbso-rf_MostImportantSubsidiaryConsolidated as its parent");
                }
            }
        }