Beispiel #1
0
        public void TestUsGaap2008_DimensionValidation()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = TestCommon.FolderRoot + @"XBRLUSGAAPTaxonomies-2008-02-13\ind\ci\us-gaap-ci-stm-2008-01-31.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.CurrentLabelRole = "preferredLabel";

            ArrayList nodes = s.GetNodesByPresentation(true);

            s.TryBuildDimensionValidationInformation();

            ArrayList segments = new ArrayList();
            ArrayList scenarios = new ArrayList();

            string elementId = "us-gaap_NetIncomeLossAvailableToCommonStockholdersBasic";

            Segment seg = new Segment();
            seg.DimensionInfo = new ContextDimensionInfo();
            seg.DimensionInfo.dimensionId = "us-gaap_StatementScenarioAxis";
            seg.DimensionInfo.Id = "us-gaap_ScenarioActualMember";

            segments.Add(seg);

            string error;
            bool ret = s.IsDimensionInformationValid(elementId, segments, scenarios, out error);

            Assert.IsFalse(ret, "should return failure");
            Console.WriteLine(error);
            s.linkbaseFileInfos.Sort();

            foreach (LinkbaseFileInfo lbfi in s.linkbaseFileInfos)
            {
                Console.WriteLine(lbfi.ToString());
            }
        }
Beispiel #2
0
        public void TestUsGaap2008_DimensionValidation2()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = @"C:\Users\srikanth.srinivasan\AppData\Roaming\Rivet\CrossTag\Taxonomies\cov\cov.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.CurrentLabelRole = "preferredLabel";

            ArrayList nodes = s.GetNodesByPresentation(true);

            s.TryBuildDimensionValidationInformation();

            ArrayList segments = new ArrayList();
            ArrayList scenarios = new ArrayList();

            string elementId = "us-gaap_GainLossRelatedToLitigationSettlement";

            Segment seg = new Segment();
            seg.DimensionInfo = new ContextDimensionInfo();
            seg.DimensionInfo.dimensionId = "us-gaap_ProductOrServiceAxis";
            seg.DimensionInfo.Id = "cov_LitigationLossMember";

            segments.Add(seg);

            string error;
            bool ret = s.IsDimensionInformationValid(elementId, segments, scenarios, out error);

            Assert.IsFalse(ret, "should return failure");
            Console.WriteLine(error);
            s.linkbaseFileInfos.Sort();

            foreach (LinkbaseFileInfo lbfi in s.linkbaseFileInfos)
            {
                Console.WriteLine(lbfi.ToString());
            }
        }
Beispiel #3
0
        public void TestUsGaap2007_ci_spc()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = TestCommon.FolderRoot + @"USFRTF-2007-10-30-prerelease" + System.IO.Path.DirectorySeparatorChar + "us-gaap-stm-ci-spc-2007-12-31.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            foreach (ParserMessage  err in s.errorList)
            {
                Console.WriteLine(err.ToString() );
            }

            Assert.AreEqual(0, errors, "should not have any errors");

            Assert.AreEqual(13301, s.allElements.Count, "wrong number of elements returned");

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

            ArrayList nodes = s.GetNodesByPresentation();

            DateTime end = DateTime.Now;

            int count = 0;
            int dimensionNodeCount = 0;
            foreach (Node n in nodes)
            {
                StringBuilder sb = DisplayNode(n, 0, ref count, ref dimensionNodeCount);
                Console.WriteLine(sb.ToString());
            }
            Console.WriteLine("Count of elements in presentation = {0}", count);
            Console.WriteLine("time taken = {0}", end - start);
        }
Beispiel #4
0
        public void TestTryGetPresentationSequenceForReviewersGuide3()
        {
            string fileName = @"S:\TESTSCHEMAS\RRD-20100630\rrd-20100630.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            ArrayList nodes = s.GetNodesByPresentation();

            foreach (Node n in nodes)
            {

                Console.WriteLine(n.GetPresentationLink().Title);
            }

            List<string> reportSeq;
            Dictionary<string, string> excelNameToReportNameMap;
            s.TryGetPresentationSequenceForReviewersGuide(null, out excelNameToReportNameMap, out reportSeq);

            foreach (string r in reportSeq)
            {
                Console.WriteLine("Excel SheetName {0} Report name {1}", r, excelNameToReportNameMap[r]);
            }
        }
Beispiel #5
0
        public void TestPepsi()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = @"\\app1\shared\XBRL Stuff\ID_SECFilers\Pepsi\quarter ended September 6, 2008\pep-20080906.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.CurrentLabelRole = "preferredLabel";

            ArrayList ret =  s.GetNodesByPresentation();
        }
Beispiel #6
0
        public void TestDEI2007_Ext()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = TestCommon.FolderRoot + @"USFRTF-2007-10-30-prerelease" + System.IO.Path.DirectorySeparatorChar + "Test6.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

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

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            Assert.AreEqual(11, s.roleRefs.Count);

            foreach (RoleRef rr in s.roleRefs.Values)
            {
                Assert.IsTrue(rr.GetHref().Contains("us-roles-2007-12-31.xsd"), "href in the role ref is not valid");
            }

            s.CurrentLanguage = "en";
            s.CurrentLabelRole = "preferredLabel";
            ArrayList nodes = s.GetNodesByPresentation(true);

            DateTime end = DateTime.Now;

            Console.WriteLine("time taken = {0}", end - start);
            int count = 0;
            int dimensionNodeCount = 0;
            foreach (Node n in nodes)
            {
                StringBuilder sb = DisplayNode(n, 0, ref count, ref dimensionNodeCount);
                Console.WriteLine(sb.ToString());
            }
            Console.WriteLine("Count of elements in presentation = {0}", count);
            Console.WriteLine("Count of dimension elements in presentation = {0}", dimensionNodeCount);
            Console.WriteLine("time taken = {0}", end - start);
        }
Beispiel #7
0
        /// <exclude/>
        private void TestUsGaap2009Web(string fileName)
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

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

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

            Assert.AreEqual(0, errors, "should not have any errors");
            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.currentLabelRole =  PresentationLocator.preferredLabelRole;
            start = DateTime.Now;
            s.GetNodesByPresentation(true);
            s.GetNodesByPresentation();
            s.GetNodesByCalculation();
            List<DimensionNode> tmp;
            s.TryGetAllDimensionNodesForDisplay(s.currentLanguage, s.currentLabelRole,
                true, out tmp);

            end = DateTime.Now;

            Console.WriteLine("GET NODES BY PRESENTATION TIME = {0}", end - start);
            //all the href references should be web based....
            foreach (RoleRef rr in s.roleRefs.Values)
            {
                Assert.IsTrue(rr.href.StartsWith("http"), "Failed ot build the correct href");
            }

            foreach (RoleType rt in s.roleTypes.Values)
            {
                Assert.IsTrue(rt.GetHref().StartsWith("http"), "Failed to build the correct href");
            }

            foreach( TaxonomyItem ti in s.TaxonomyItems )
            {
                Assert.IsTrue(ti.Location.StartsWith("http"), "Failed ot build the correct href");

            }

            int countCustomTypeTax = 0;
            foreach (TaxonomyItem ti in s.infos)
            {
                if (ti.HasCustomTypes)
                {
                    countCustomTypeTax++;
                    Console.WriteLine("FOUND CUSTOM TYPES INFO");
                    Console.WriteLine(ti.WebLocation + ti.Location);

                }
            }
            Assert.AreEqual(1, countCustomTypeTax, "Should have only one custom type taxonomy");
            List<string> xsdNames = new List<string>();
            foreach (LinkbaseFileInfo lfi in s.linkbaseFileInfos)
            {

                foreach (string role in lfi.RoleRefURIs)
                {
                    Console.WriteLine(" ROLE = {0} XSD = {1}", role , lfi.XSDFileName);

                }
            }

            Dictionary<string, string> linkbaseXSDMap = new Dictionary<string, string>();

            foreach (Taxonomy depT in s.DependantTaxonomies)
            {
                string xsdName = Path.GetFileName(depT.infos[0].Location);

                if (depT.presentationFile != null)
                {
                    foreach (string file in depT.presentationFile)
                    {
                        string val;
                        if (linkbaseXSDMap.TryGetValue(Path.GetFileName(file), out val))
                        {
                            if (!val.Equals(xsdName))
                            {
                                Console.WriteLine("FOUND TWO XSD INCLUDING THE SAME PRESENTATION LINKBASE ");
                                Console.WriteLine("{0} {1}", xsdName, val);
                            }
                        }
                        else
                        {
                            linkbaseXSDMap.Add(Path.GetFileName(file), xsdName);
                        }
                        Console.WriteLine("{0} - {1}", Path.GetFileName(file), xsdName);
                    }
                }
                if (depT.DefinitionFile != null)
                {
                    foreach (string file in depT.DefinitionFile)
                    {
                        string val;
                        if (linkbaseXSDMap.TryGetValue(Path.GetFileName(file), out val))
                        {
                            if (!val.Equals(xsdName))
                            {
                                Console.WriteLine("FOUND TWO XSD INCLUDING THE SAME DEFINITION LINKBASE ");
                                Console.WriteLine("{0} {1}", xsdName, val);
                            }
                        }
                        else
                        {
                            linkbaseXSDMap.Add(Path.GetFileName(file), xsdName);
                        }
                        Console.WriteLine("{0} - {1}", Path.GetFileName(file), xsdName);
                    }
                }
                if (depT.calculationFile != null)
                {
                    foreach (string file in depT.calculationFile)
                    {
                        string val;
                        if (linkbaseXSDMap.TryGetValue(Path.GetFileName(file), out val))
                        {
                            if (!val.Equals(xsdName))
                            {
                                Console.WriteLine("FOUND TWO XSD INCLUDING THE SAME  CALCULATION LINKBASE ");
                                Console.WriteLine("{0} {1}", xsdName, val);
                            }
                        }
                        else
                        {
                            linkbaseXSDMap.Add(Path.GetFileName(file), xsdName);
                        }
                        Console.WriteLine("{0} - {1}", Path.GetFileName(file), xsdName);
                    }
                }

                if (depT.LabelFile != null)
                {
                    foreach (string file in depT.LabelFile)
                    {
                        string val;
                        if (linkbaseXSDMap.TryGetValue(Path.GetFileName(file), out val))
                        {
                            if (!val.Equals(xsdName))
                            {
                                Console.WriteLine("FOUND TWO XSD INCLUDING THE SAME LABEL LINKBASE ");
                                Console.WriteLine("{0} {1}", xsdName, val);
                            }
                        }
                        else
                        {
                            linkbaseXSDMap.Add(Path.GetFileName(file), xsdName);
                        }
                        Console.WriteLine("{0} - {1}", Path.GetFileName(file), xsdName);
                    }
                }

                if (depT.ReferenceFile != null)
                {
                    foreach (string file in depT.ReferenceFile)
                    {
                        string val;
                        if (linkbaseXSDMap.TryGetValue(Path.GetFileName(file), out val))
                        {
                            if (!val.Equals(xsdName))
                            {
                                Console.WriteLine("FOUND TWO XSD INCLUDING THE SAME REFERENCE LINKBASE ");
                                Console.WriteLine("{0} {1}", xsdName, val);
                            }
                        }
                        else
                        {
                            linkbaseXSDMap.Add(Path.GetFileName(file), xsdName);
                        }
                        Console.WriteLine("{0} - {1}", Path.GetFileName(file), xsdName);
                    }
                }

            }
        }