예제 #1
0
        public void FMC_LoadAndParse()
        {
            TestTaxonomy_FMC_20061231 s = new TestTaxonomy_FMC_20061231();

            int errors = 0;

            if (s.Load(FMC_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();


            Element eById_1 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeDerivativeInstrumentsOther_3c4e89"];

            Assert.IsNotNull(eById_1, "eById_1 is null");

            Element eByName_1 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeDerivativeInstrumentsOther"];

            Assert.IsNotNull(eByName_1, "eByName_1 is null");

            Assert.AreEqual(eById_1, eByName_1, "eById_1 != eByName_1");

            Node nById   = Node.RecursivelyGetNode(nodes, eById_1.Id);
            Node nByName = Node.RecursivelyGetNode(nodes, eByName_1.Id);

            Assert.AreEqual(nById.Parent, nByName.Parent, "eById_1.Tag.Parent != eByName_1.Tag.Parent");


            Element eById_2 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeEmployeeBenefitRelated_14f6bdb"];

            Assert.IsNotNull(eById_2, "eById_2 is null");

            Element eByName_2 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeEmployeeBenefitRelated"];

            Assert.IsNotNull(eByName_2, "eByName_2 is null");

            Assert.AreEqual(eById_2, eByName_2, "eById_2 != eByName_2");


            Element eById_3 = (Element)s.AllElements["fmc_ForeignCurrencyTranslation_3a43af"];

            Assert.IsNotNull(eById_3, "eById_3 is null");

            Element eByName_3 = (Element)s.AllElements["fmc_ForeignCurrencyTranslation"];

            Assert.IsNotNull(eByName_3, "eByName_3 is null");

            Assert.AreEqual(eById_3, eByName_3, "eById_3 != eByName_3");
        }
        public void FMC_LoadAndParse()
        {
            TestTaxonomy_FMC_20061231 s = new TestTaxonomy_FMC_20061231();

            int errors = 0;

            if ( s.Load( FMC_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();

            Element eById_1 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeDerivativeInstrumentsOther_3c4e89"];
            Assert.IsNotNull( eById_1, "eById_1 is null" );

            Element eByName_1 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeDerivativeInstrumentsOther"];
            Assert.IsNotNull( eByName_1, "eByName_1 is null" );

            Assert.AreEqual( eById_1, eByName_1, "eById_1 != eByName_1" );

            Node nById = Node.RecursivelyGetNode(nodes, eById_1.Id);
            Node nByName = Node.RecursivelyGetNode(nodes, eByName_1.Id);

            Assert.AreEqual(nById.Parent, nByName.Parent, "eById_1.Tag.Parent != eByName_1.Tag.Parent");

            Element eById_2 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeEmployeeBenefitRelated_14f6bdb"];
            Assert.IsNotNull( eById_2, "eById_2 is null" );

            Element eByName_2 = (Element)s.AllElements["fmc_AccumulatedOtherComprehensiveIncomeEmployeeBenefitRelated"];
            Assert.IsNotNull( eByName_2, "eByName_2 is null" );

            Assert.AreEqual( eById_2, eByName_2, "eById_2 != eByName_2" );

            Element eById_3 = (Element)s.AllElements["fmc_ForeignCurrencyTranslation_3a43af"];
            Assert.IsNotNull( eById_3, "eById_3 is null" );

            Element eByName_3 = (Element)s.AllElements["fmc_ForeignCurrencyTranslation"];
            Assert.IsNotNull( eByName_3, "eByName_3 is null" );

            Assert.AreEqual( eById_3, eByName_3, "eById_3 != eByName_3" );
        }