Exemple #1
0
        public void CheckAppend()
        {
            ArrayList errors = new ArrayList();

            TestPresentationLocator parent        = new TestPresentationLocator("label", "parent#parent");
            TestPresentationLocator parentToMerge = new TestPresentationLocator("label", "parent#parent");

            PresentationLocator pl1 = new PresentationLocator("child#child");

            pl1.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl2 = new PresentationLocator("child#child2");

            pl2.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            parentToMerge.AddChild(pl1, 1.0F, "pref", "1");
            parentToMerge.AddChild(pl2, 2.0F, "pref", "1");

            parent.Append(parentToMerge);

            Assert.AreEqual(parent.childDisplayOrder.Count, 2, "wrong number of orders");
            Assert.AreEqual(parent.childLocatorsByHRef.Count, 2, "wrong number of href's");
        }
Exemple #2
0
        public void GAAP_Parse()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

            DateTime start = DateTime.Now;

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

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementCashFlows"] as PresentationLink;

            Assert.IsNotNull(pl, "presentation link not found");

            Assert.IsNotNull(pl.BaseSchema, "PresentationLink BaseSchema is null");
            Assert.AreEqual("http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd", pl.BaseSchema, "BaseSchema wrong");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pte_NetIncreaseDecreaseCashCashEquivalents", out ploc));

            Assert.AreEqual(0, errors, "parse failure");

            if (s.numWarnings > 0)
            {
                Assert.AreEqual(s.numWarnings, SendWarningsToConsole(s.errorList), "numWarnings doesn't match warnings reported in the errorList");
            }

            Assert.AreEqual(0, s.numWarnings, "wrong number of warnings ");

            // 57 = bind failures - elements w/o presentation

            //Trace.Listeners.Clear();
            TimeSpan level = new TimeSpan(0, 0, 0, 5, 0);               // 5 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long - " + (end - start) + " seconds");
        }
Exemple #3
0
        [Test] public void IFRS_Parse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_IFRS_2004_06_15 s = new TestTaxonomy_IFRS_2004_06_15();

            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);

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

            DateTime end = DateTime.Now;

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

            TimeSpan level = new TimeSpan(0, 0, 0, 4, 0);               // 4 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long");

            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");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("ifrs-gp_HedgingInstrumentsNonCurrentLiability", out ploc));

            // 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

            //Trace.Listeners.Clear();
        }
Exemple #4
0
        public void BASI_Parse()
        {
            TestTaxonomy_2004_08_15 s = new TestTaxonomy_2004_08_15();
            int errors = 0;

            DateTime start = DateTime.Now;

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

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



            DateTime end = DateTime.Now;

            if (errors > 0)
            {
                SendErrorsToConsole(s.errorList);
            }
            Console.WriteLine("Parse Time: {0}", end - start);

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementCashFlowsDirect"] as PresentationLink;

            Assert.IsNotNull(pl, "presentation link not found");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pt_NetIncreaseDecreaseCashCashEquivalents", out ploc));

            Assert.AreEqual(0, errors, "parse failure");

            // 1 - duplicate element
            if (s.numWarnings > 7)
            {
                Assert.AreEqual(s.numWarnings, SendWarningsToConsole(s.errorList), "numWarnings doesn't match warnings reported in the errorList");
            }

            Assert.AreEqual(7, s.numWarnings, "wrong number of warnings ");

            TimeSpan level     = new TimeSpan(0, 0, 0, 8, 0);           // 8 seconds to parse
            TimeSpan timeTaken = end - start;

            Assert.IsTrue(level > timeTaken, "Parse takes too long - " + timeTaken.ToString() + " seconds");
        }
Exemple #5
0
        [Test] public void GAAP_Parse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_2004_06_15 s = new TestTaxonomy_2004_06_15();

            int errors = 0;

            DateTime start = DateTime.Now;

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

            TimeSpan level = new TimeSpan(0, 0, 0, 4, 0);               // 4 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long");

            PresentationLink pl = s.presentationInfo["Statement of Cash Flows - Direct Method - CI"] as PresentationLink;

            Assert.IsNotNull(pl);

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pt_NetIncreaseDecreaseCashCashEquivalents", out ploc));

            Assert.AreEqual(22 + 690 + 5 + 4 + 5 + 953 + 1474, errors, "parse failure");

            // 22 = presentation load errors
            // 690 = bind failures - elements w/o presentation
            // 5 = imports - 5 duplicate elements
            // 4 = duplicate labels
            // 5 = elements without matching labels
            // 953 = elements without ref
            // 1474 = element without calc

            //Trace.Listeners.Clear();
        }
Exemple #6
0
        public void CheckAppend3()
        {
            ArrayList errors = new ArrayList();

            TestPresentationLocator parent        = new TestPresentationLocator("label", "parent#parent");
            TestPresentationLocator parentToMerge = new TestPresentationLocator("label", "parent#parent");

            PresentationLocator pl1 = new PresentationLocator("child#child");

            pl1.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl2 = new PresentationLocator("child#child2");

            pl2.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl3 = new PresentationLocator("child#child");

            pl3.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl4 = new PresentationLocator("child#child2");

            pl4.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            parent.AddChild(pl1, 1.0F, "pref", "1");
            parent.AddChild(pl2, 2.0F, "pref", "1");

            parentToMerge.AddChild(pl3, 1.0F, "pref", "1");
            parentToMerge.AddChild(pl4, "label", "2", 2.0F, "pref", "1", true);

            parent.Append(parentToMerge);

            Assert.AreEqual(parent.childDisplayOrder.Count, 2, "wrong number of orders");
            Assert.AreEqual(parent.childLocatorsByHRef.Count, 2, "wrong number of href's");
            int count = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos.Count;
            LocatorRelationshipInfo lri = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos[count - 1] as LocatorRelationshipInfo;

            Assert.IsTrue(lri.IsProhibited);
        }
Exemple #7
0
        [Test] public void GAAP_Parse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_2004_07_06 s = new TestTaxonomy_2004_07_06();

            int errors = 0;

            DateTime start = DateTime.Now;

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

            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect"] as PresentationLink;

            Assert.IsNotNull(pl, "presentation link is null");

            PresentationLocator ploc = null;

            Assert.IsTrue(pl.TryGetLocator("usfr-pt_NetIncreaseDecreaseCashCashEquivalents", out ploc));

            // problem with presentation linkbase - don't know the solution yet
            Assert.AreEqual(5, errors, "parse failure");

            Assert.AreEqual(2, s.numWarnings, "wrong number of warnings");
            // 2 = duplicate labels

            //Trace.Listeners.Clear();

            TimeSpan level = new TimeSpan(0, 0, 0, 4, 0);               // 4 seconds to parse

            Assert.IsTrue(level > (end - start), "Parse takes too long");
        }
Exemple #8
0
        public void GAAP_TestDependantPresentations()
        {
            TestTaxonomy_2005_02_28 s = new TestTaxonomy_2005_02_28();
            int errors = 0;

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

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

            s.LoadPresentation(out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            errorList.Clear();
            errors = s.numWarnings = 0;
            s.LoadElements(out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            // and now bind elements to presentation
            errorList.Clear();
            errors = s.numWarnings = 0;
            s.BindPresentationCalculationElements(true, out errors);

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

            if (s.numWarnings > 0)
            {
                SendWarningsToConsole(s.errorList);
                SendInfoToConsole(s.errorList);
            }

            // ok, now do some testing
            PresentationLink pl = s.presentationInfo["http://www.xbrl.org/us/fr/lr/role/StatementFinancialPosition"] as PresentationLink;

            Assert.IsNotNull(pl, "Presentation link is null");

            PresentationLocator presLocator = null;

            pl.TryGetLocator("usfr-pte_CommonStockShareSubscriptions", out presLocator);

            Assert.IsNotNull(presLocator, "presentation Locator not found");
        }
Exemple #9
0
 /// <exclude/>
 public TestPresentationLocator(PresentationLocator pl)
     : base(pl)
 {
 }