Пример #1
0
        public void IFRS_BindCalculation()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

            s.numWarnings = errors = 0;
            s.BindPresentationCalculationElements( false, out errors );
            if ( errors != 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            Assert.AreEqual( 0, errors, "Bind calc failed" );
            Assert.AreEqual( 0, s.numWarnings, "num warnings wrong" );
        }
Пример #2
0
        public void VerifyTupleOfTuples()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load( IFRS_06_15_FILE );

            int errors = 0;

            s.Parse( out errors );

            // find EquityCompensationPlan - it's a tuple, and should have ShareOptionsExercisedUnderEquityCompensationPlansDuringPeriod as a child
            // (it's also a tuple)

            Element e = s.allElements[ "ifrs-gp_EquityCompensationPlan" ] as Element;
            Assert.IsNotNull( e, "can't find ifrs-gp_EquityCompensationPlan" );

            bool found = false;
            foreach ( Element ec in e.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "ifrs-gp_ShareOptionsExercisedUnderEquityCompensationPlansDuringPeriod" )
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue( found, "could not find ShareOptionsExercisedUnderEquityCompensationPlansDuringPeriod" );

            Element ele = s.allElements["ifrs-gp_ShareOptionsExercisedUnderEquityCompensationPlansDuringPeriod"] as Element;
            Assert.IsNotNull(ele, "element should not be null");

            Assert.IsTrue(ele.HasTupleParents, "ifrs-gp_ShareOptionsExercisedUnderEquityCompensationPlansDuringPeriod should have tuple parents ");

            // find RelatedParty - it's a tuple, and should have TransactionRelatedParty as a child
            // (it's also a tuple)

            e = s.allElements[ "ifrs-gp_RelatedParty" ] as Element;
            Assert.IsNotNull( e, "can't find ifrs-gp_RelatedParty" );

            found = false;
            foreach ( Element ec in e.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "ifrs-gp_TransactionRelatedParty" )
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue( found, "could not find ifrs-gp_TransactionRelatedParty" );
            ele = s.allElements["ifrs-gp_TransactionRelatedParty"] as Element;
            Assert.IsNotNull(ele, "element should not be null");

            Assert.IsTrue(ele.HasTupleParents, "ifrs-gp_TransactionRelatedParty should have tuple parents ");

            // find EquityCompensationPlan - it's a tuple, and should have EquityInstrumentIssuedEquityCompensationPlan  as a child
            // (it's also a tuple)

            e = s.allElements[ "ifrs-gp_EquityCompensationPlan" ] as Element;
            Assert.IsNotNull( e, "can't find ifrs-gp_EquityCompensationPlan" );

            found = false;
            foreach ( Element ec in e.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "ifrs-gp_EquityInstrumentIssuedEquityCompensationPlan" )
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue( found, "could not find ifrs-gp_EquityInstrumentIssuedEquityCompensationPlan " );
            ele = s.allElements["ifrs-gp_EquityInstrumentIssuedEquityCompensationPlan"] as Element;
            Assert.IsNotNull(ele, "element should not be null");

            Assert.IsTrue(ele.HasTupleParents, "ifrs-gp_EquityInstrumentIssuedEquityCompensationPlan should have tuple parents ");

            // find EquityCompensationPlan - it's a tuple, and should have MajorClassAssetLiabilityEntityAcquired as a child
            // (it's also a tuple)

            e = s.allElements[ "ifrs-gp_Acquisition" ] as Element;
            Assert.IsNotNull( e, "can't find ifrs-gp_Acquisition" );

            found = false;
            foreach ( Element ec in e.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "ifrs-gp_MajorClassAssetLiabilityEntityAcquired" )
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue( found, "could not find ifrs-gp_MajorClassAssetLiabilityEntityAcquired " );
            ele = s.allElements["ifrs-gp_MajorClassAssetLiabilityEntityAcquired"] as Element;
            Assert.IsNotNull(ele, "element should not be null");

            Assert.IsTrue(ele.HasTupleParents, "ifrs-gp_MajorClassAssetLiabilityEntityAcquired should have tuple parents ");

            // find EquityCompensationPlan - it's a tuple, and should have OwnEquityInstrumentHeldEquityCompensationPlan as a child
            // (it's also a tuple)

            e = s.allElements[ "ifrs-gp_EquityCompensationPlan" ] as Element;
            Assert.IsNotNull( e, "can't find ifrs-gp_EquityCompensationPlan" );

            found = false;
            foreach ( Element ec in e.TupleChildren.GetValueList() )
            {
                if ( ec.Id == "ifrs-gp_OwnEquityInstrumentHeldEquityCompensationPlan" )
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue( found, "could not find ifrs-gp_OwnEquityInstrumentHeldEquityCompensationPlan " );

            ele = s.allElements["ifrs-gp_OwnEquityInstrumentHeldEquityCompensationPlan"] as Element;
            Assert.IsNotNull(ele, "element should not be null");

            Assert.IsTrue( ele.HasTupleParents , "ifrs-gp_OwnEquityInstrumentHeldEquityCompensationPlan should have tuple parents ");
        }
Пример #3
0
        public void IFRS_VerifyPresentationCorrect()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.Load( IFRS_FILE);

            int errors = 0;

            s.Parse( out errors );

            string rawXml = s.ToXmlString();

            s.currentLabelRole = "terseLabel";
            s.CurrentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();
        }
Пример #4
0
        public void IFRS_Test_VerifyTuples()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load( IFRS_FILE);

            int errors = 0;

            s.Parse( out errors );

            ArrayList nodeList = s.GetNodesByElement();

            Assert.IsNotNull( nodeList );
            Assert.AreEqual( 2586, nodeList.Count );

            Console.WriteLine( "Found Tuple Nodes: " );

            foreach (Node n in nodeList )
            {
                RecurseVerifyTuples( n );
            }
        }
Пример #5
0
        public void IFRS_Test_GetNodesByPresentation()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.CurrentLabelRole = "label";
            s.CurrentLanguage = "en";

            s.Load( IFRS_FILE);

            int errors = 0;

            s.Parse( out errors );

            ArrayList nodeList = s.GetNodesByPresentation();

            Assert.IsNotNull( nodeList );
            Assert.AreEqual( 24, nodeList.Count );

            Console.WriteLine( "Nodes By Presentation: " );

            foreach (Node n in nodeList )
            {
                Console.WriteLine( TestNode.ToXml( 0, n ) );
            }
        }
Пример #6
0
        public void IFRS_TestTuples()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            int errors = 0;

            s.Load( IFRS_FILE );

            s.Parse( out errors );

            IDictionaryEnumerator enumer = s.allElements.GetEnumerator();

            Console.WriteLine( "Found Tuple Elements: " );

            while ( enumer.MoveNext() )
            {
                RecurseElementsForTuples( enumer.Value as Element );
            }
        }
Пример #7
0
        public void IFRS_Spanish_2005_04_11_Parse()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            //now check the taxonomy properties
            //there should be 2 taxonomy infos
            Assert.AreEqual(2, s.infos.Count, "wrong number of taxonomy infos");

            //there should be 0 warnings and 0 errors
            Assert.AreEqual(0, s.ValidationWarnings.Count, "warnings not 0");
            Assert.AreEqual(0, s.ValidationErrors.Count, "errors not 0");

            //there should be 4318 elements
            Assert.AreEqual(4318, s.allElements.Count, "wrong number of elements");

            //there should be 5 enumerations + 2 boolean
            Assert.AreEqual(5+2, s.enumTable.Count, "wrong number of enumerations");

            //there should be 1 calculation file and 32 top level nodes
            Assert.AreEqual(1, s.calculationFile.Length, "wrong number of calculation files");
            Assert.AreEqual(32, s.calculationInfo.Count, "wrong number of top level calculation nodes");

            //there should be 1 presentation file and 31 top level nodes
            Assert.AreEqual(1, s.presentationFile.Length, "wrong number of presentation files");
            Assert.AreEqual(31, s.presentationInfo.Count, "wrong number of top level presentation nodes");

            //there should be 8 label roles and 4473 labels
            Assert.AreEqual(8, s.labelRoles.Count, "wrong number of label roles");
            Assert.AreEqual(4318, s.labelHrefHash.Count, "wrong number of labels");

            //there should be 4250 references
            Assert.AreEqual(4250, s.referenceTable.Count, "wrong number of references");
        }
Пример #8
0
        public void IFRS_Parse_Label()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );
            DateTime end = DateTime.Now;
            Console.WriteLine( "Parse Time: {0}", end-start );

            Element el = s.allElements["ifrs-gp_WorkInProgress"] as Element;
            Assert.IsNotNull( el, "can't find ifrs-gp_WorkInProgress" );
            string labelString = string.Empty;
            el.TryGetLabel("en", "label", out labelString);
            Assert.IsTrue(labelString != "",  "label info is not populated");
        }
Пример #9
0
        public void IFRS_RC4_Parse()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            //now check the taxonomy properties
            //there should be 3 taxonomy infos
            Assert.AreEqual(4, s.infos.Count, "wrong number of taxonomy infos");

            //there should be 0 warnings and 0 errors
            Assert.AreEqual(0, s.ValidationWarnings.Count, "warnings not 0");
            Assert.AreEqual(0, s.ValidationErrors.Count, "errors not 0");

            //there should be 4106 elements
            Assert.AreEqual(4106, s.allElements.Count, "wrong number of elements");

            //there should be 5 enumerations + 2 boolean
            Assert.AreEqual(5+2, s.enumTable.Count, "wrong number of enumerations");

            //there should be 19 calculation files and 26 top level nodes
            Assert.AreEqual(19, s.calculationFile.Length, "wrong number of calculation files");
            Assert.AreEqual(26, s.calculationInfo.Count, "wrong number of top level calculation nodes");

            //there should be 21 presentation files and 23 top level nodes
            Assert.AreEqual(21, s.presentationFile.Length, "wrong number of presentation files");
            Assert.AreEqual(23, s.presentationInfo.Count, "wrong number of top level presentation nodes");

            //there should be 4 label roles and 4106 labels
            Assert.AreEqual(4, s.labelRoles.Count, "wrong number of label roles");
            Assert.AreEqual(4106, s.labelHrefHash.Count, "wrong number of labels");

            //there should be 4106 references
            Assert.AreEqual(4106, s.referenceTable.Count, "wrong number of references");
        }
Пример #10
0
        public void IFRS_Parse_2005_01_15()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            DateTime end = DateTime.Now;
            Console.WriteLine( "Parse Time: {0}", end-start );

            TimeSpan level = new TimeSpan( 0, 0, 0, 30, 0 );	// 30 seconds to parse
            Assert.IsTrue( level > (end-start), "Parse takes too long - " + (end-start) + " seconds"  );

            PresentationLink pl = s.presentationInfo["http://xbrl.iasb.org/int/fr/ifrs/gp/role/BalanceSheetClassified"] as PresentationLink;
            Assert.IsNotNull( pl, "can't find Balance Sheet, Classified Format" );

            // problem with presentation linkbase - don't know the solution yet
            Assert.AreEqual( 0, errors, "parse failure" );
            Assert.AreEqual( 0, s.numWarnings, "wrong number of warnings " );

            // 1712 = calculation warnings

            Console.WriteLine( "ifrs_2005_01_15 elements: " + s.AllElements.Count );
        }
Пример #11
0
        public void IFRS_Parse_2005_01_15_GetNodes()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

            if ( errors > 0 )
            {
                SendErrorsToConsole( s.errorList );
            }

            Console.WriteLine( "ifrs_2005_01_15 elements: " + s.AllElements.Count );

            s.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage	= "en";

            ArrayList nodes = s.GetNodesByPresentation();
        }
Пример #12
0
        public void IFRS_OutputTaxonomyByNodes()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.Load( IFRS_FILE);

            int errors = 0;

            s.Parse( out errors );

            #if !AUTOMATED
            using ( StreamWriter sw = new StreamWriter( NODE_OUT_FILE ) )
            {
                s.currentLanguage = "en";
                s.currentLabelRole = "terseLabel";

                sw.Write( s.ToXmlString( s.GetNodesByPresentation() ) );
            }
            #endif
        }
Пример #13
0
        public void IFRS_OutputTaxonomy()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.Load( IFRS_FILE);

            int errors = 0;

            s.Parse( out errors );

            #if !AUTOMATED
            using ( StreamWriter sw = new StreamWriter( IFRS_OUT_FILE ) )
            {
                sw.Write( s.ToXmlString( false ) );
            }
            #endif
        }
Пример #14
0
        public void IFRS_GetSupportedLanguages()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.Load( IFRS_FILE);

            int errors = 0;
            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList langs = s.GetSupportedLanguages(false, out errors);

            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 1, langs.Count );
            Assert.AreEqual( "en", langs[0] );
        }
Пример #15
0
        public void IFRS_GetLabelRoles()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();

            s.Load( IFRS_FILE );

            int errors = 0;
            s.Parse(out errors);
            Assert.AreEqual(0, errors);
            ArrayList roles = s.GetLabelRoles(false, out errors);

            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 4, roles.Count );
            Assert.AreEqual( "label", roles[0] );
            Assert.AreEqual( "periodEndLabel", roles[1] );
            Assert.AreEqual( "periodStartLabel", roles[2] );
            Assert.AreEqual( "restatedLabel", roles[3] );
            //Assert.AreEqual( "documentation", roles[3] );
        }
Пример #16
0
        public void IFRS_ElementTaxonomyLinks()
        {
            TestTaxonomy_IFRS s = new TestTaxonomy_IFRS();
            int errors = 0;

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

            errors = 0;
            s.Parse( out errors );

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

            ArrayList nodes = s.GetNodesByElement();
            Assert.AreEqual( 0, ((Node)nodes[0]).TaxonomyInfoId, "Taxonomy id not correct" );

            TaxonomyItem ti = s.GetTaxonomyInfo( (Node)nodes[0] );

            Assert.AreEqual( "http://xbrl.iasb.org/int/fr/ifrs/gp/2004-11-15", ti.WebLocation, "target namespace wrong" );
            Assert.AreEqual( IFRS_FILE, ti.Location, "targetLocation wrong" );
        }