Ejemplo n.º 1
0
        public void Test_ExtendedTupleLabelsResolution()
        {
            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();

            int    errors   = 0;
            string fileName = TestCommon.FolderRoot + @"faif-20071031" + System.IO.Path.DirectorySeparatorChar + "faif-20071031.xsd";

            if (s.Load(fileName, 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);
            }
            s.CurrentLabelRole = PresentationLocator.preferredLabelRole;
            s.CurrentLanguage  = "en";


            ArrayList nodes = s.GetNodesByPresentation();

            ArrayList flatList = new ArrayList();

            GetFlatListOfPresentationNodes(nodes, ref flatList);

            Hashtable expectedValues = new Hashtable();

            expectedValues["usfr-ime_InvestmentDescription"]  = "Investment Description";
            expectedValues["usfr-ime_NumberContracts"]        = "Number of Contracts";
            expectedValues["usfr-ime_ContractsHeldLongShort"] = "Are Contracts Held Long or Short?";
            expectedValues["usfr-ime_ExpirationDate"]         = "Expiration Date";
            expectedValues["usfr-ime_FaceValue"] = "Face Value";
            expectedValues["usfr-ime_FuturesContractUnrealizedAppreciationDepreciation"] = "Futures Contract - Unrealized Appreciation/(Depreciation)";
            expectedValues["faif_NotionalContractValue"] = "Notional Contract Value";

            foreach (Node n in flatList)
            {
                if (n.parent != null && n.parent.Id == "faif_FuturesListingTuple")
                {
                    Console.WriteLine(n.Label);
                    if (expectedValues[n.Id] != null)
                    {
                        Assert.AreEqual(expectedValues[n.Id], n.Label);
                    }
                    else
                    {
                        Assert.Fail("Failed to find child " + n.Id);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void IM_LoadAndParse()
        {
            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();
            int errors = 0;

            if (s.Load(IM_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, "parse failed");
            // 1 duplicate element

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

            Assert.IsNotNull(pl, "can't get http://www.xbrl.org/us/fr/lr/role/PortfolioInvestments");

            Node parentNode = pl.CreateNode("en", "Label");

            Assert.AreEqual(1, parentNode.Children.Count, "wrong number of children");
        }
Ejemplo n.º 3
0
        public void OM_20060430_FILE_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();

            int errors = 0;

            if (s.Load(OM_20060430_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, "wrong number of errors");
            // 1 duplicate element
            Element RepurchaseAgreementsTuple = s.AllElements["usfr-ime_RepurchaseAgreementsTuple"] as Element;

            Assert.IsNotNull(RepurchaseAgreementsTuple, "Failed to find RepurchaseAgreementsTuple");

            Assert.IsTrue(RepurchaseAgreementsTuple.HasChildren, "RepurchaseAgreementsTuple does nothave any children");
        }
Ejemplo n.º 4
0
        public void IM_2005_06_28_LoadAndParse()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();

            int errors = 0;

            if ( s.Load( IM_2005_06_28_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, "wrong number of errors" );
            // 1 duplicate element
            Element RepurchaseAgreementsTuple = s.AllElements["usfr-ime_RepurchaseAgreementsTuple"] as Element;

            Assert.IsNotNull(RepurchaseAgreementsTuple, "Failed to find RepurchaseAgreementsTuple");

            Assert.IsTrue(RepurchaseAgreementsTuple.HasChildren, "RepurchaseAgreementsTuple does nothave any children");
        }
Ejemplo n.º 5
0
        public void IM_2005_06_28_TestBoolean()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();
            int errors = 0;

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

            // usfr-ime_AffiliatedCompany is boolean type
            Element e = s.allElements["usfr-ime_AffiliatedCompany"] as Element;

            Assert.IsNotNull(e, "usfr-ime_AffiliatedCompany element not found");

            Enumeration enumer = s.enumTable["xbrli:booleanItemType"] as Enumeration;

            Assert.IsNotNull(enumer);

            Assert.IsNotNull(e.EnumData, "no enumeration data");
            Assert.AreEqual(2, e.EnumData.Values.Count, "wrong number of enumerations");
            Assert.AreEqual("Yes", e.EnumData.Values[0], "wrong enumeration at index 0");
            Assert.AreEqual("No", e.EnumData.Values[1], "wrong enumeration at index 1");
        }
Ejemplo n.º 6
0
        public void Test_ExtendedTupleLabelsResolution()
        {
            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();

            int errors = 0;
            string fileName = TestCommon.FolderRoot + @"faif-20071031" + System.IO.Path.DirectorySeparatorChar + "faif-20071031.xsd";
            if (s.Load(fileName, 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);
            }
            s.CurrentLabelRole = PresentationLocator.preferredLabelRole;
            s.CurrentLanguage = "en";

            ArrayList nodes =   s.GetNodesByPresentation();

            ArrayList flatList = new ArrayList();
            GetFlatListOfPresentationNodes(nodes, ref flatList);

            Hashtable expectedValues = new Hashtable();
            expectedValues["usfr-ime_InvestmentDescription"] = "Investment Description";
            expectedValues["usfr-ime_NumberContracts"] = "Number of Contracts";
            expectedValues["usfr-ime_ContractsHeldLongShort"] = "Are Contracts Held Long or Short?";
            expectedValues["usfr-ime_ExpirationDate"] = "Expiration Date";
            expectedValues["usfr-ime_FaceValue"] = "Face Value";
            expectedValues["usfr-ime_FuturesContractUnrealizedAppreciationDepreciation"] = "Futures Contract - Unrealized Appreciation/(Depreciation)";
            expectedValues["faif_NotionalContractValue"] = "Notional Contract Value";

            foreach (Node n in flatList)
            {
                if (n.parent != null && n.parent.Id == "faif_FuturesListingTuple")
                {
                    Console.WriteLine(n.Label);
                    if (expectedValues[n.Id] != null)
                    {
                        Assert.AreEqual(expectedValues[n.Id], n.Label);

                    }
                    else
                    {
                        Assert.Fail("Failed to find child " + n.Id);
                    }
                }

            }
        }
Ejemplo n.º 7
0
        public void IM_LoadAndParse()
        {
            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();
            int errors = 0;

            if ( s.Load( IM_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, "parse failed" );
            // 1 duplicate element

            PresentationLink pl = s.presentationInfo[ "http://www.xbrl.org/us/fr/lr/role/PortfolioInvestments" ] as PresentationLink;
            Assert.IsNotNull( pl, "can't get http://www.xbrl.org/us/fr/lr/role/PortfolioInvestments" );

            Node parentNode = pl.CreateNode( "en", "Label" );
            Assert.AreEqual(1, parentNode.Children.Count, "wrong number of children" );
        }
Ejemplo n.º 8
0
        public void IM_2005_06_28_TestBoolean()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );

            TestTaxonomy_US_GAAP_IM s = new TestTaxonomy_US_GAAP_IM();
            int errors = 0;

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

            // usfr-ime_AffiliatedCompany is boolean type
            Element e = s.allElements["usfr-ime_AffiliatedCompany"] as Element;
            Assert.IsNotNull( e, "usfr-ime_AffiliatedCompany element not found" );

            Enumeration enumer = s.enumTable["xbrli:booleanItemType"] as Enumeration;
            Assert.IsNotNull( enumer );

            Assert.IsNotNull (e.EnumData, "no enumeration data" );
            Assert.AreEqual( 2, e.EnumData.Values.Count, "wrong number of enumerations" );
            Assert.AreEqual( "Yes", e.EnumData.Values[0], "wrong enumeration at index 0" );
            Assert.AreEqual( "No", e.EnumData.Values[1], "wrong enumeration at index 1" );
        }