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 CheckOrderDiffPriority()
        {
            PresentationLocator parent = new TestPresentationLocator("parent", "xsd#parent");
            ArrayList           errors = new ArrayList();

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

            PresentationLocator child  = new TestPresentationLocator("child", "xsd#child");
            PresentationLocator child2 = new TestPresentationLocator("child2", "xsd#child2");

//			PresentationLocator child3	= new TestPresentationLocator( "child_7.0_pro", "xsd#child" );

            child.ParseHRef(errors);
            //child.MyElement = new Element( "child_1.7", false );
            Assert.AreEqual(0, errors.Count);

            child2.ParseHRef(errors);
            //child2.MyElement = new Element( "child_7.0_opt", false );
            Assert.AreEqual(0, errors.Count);

            //child3.ParseHRef( errors );
            //child3.MyElement = new Element( "child_7.0_pro", false );
            //Assert.AreEqual( 0, errors.Count );

            PresentationLink pl = new PresentationLink("Test", "Test", new ArrayList());

            pl.AddLocator(parent);
            pl.AddLocator(child);
            pl.AddLocator(child2);

            parent.AddChild(child, "Label", "0", 1.7F, "label", "0", false);
            parent.AddChild(child, "Label", "0", 7.0F, "label", "0", false);
            parent.AddChild(child, "Label", "2", 7.0F, "label", "0", true);

            parent.AddChild(child2, "Label", "0", 2.0F, "label", "0", false);

//			pl.AddLocator( child3 );

            Node n = parent.CreateNode("en", "", "", pl);

            //should be:
            //	child (1.7)
            //	child2 (2.0)
            //  child - prohibited (7.0)

            Assert.AreEqual("parent", n.Label, "parent expected");
            Assert.AreEqual("child", ((Node)n.Children[0]).Label, "child 0 wrong");
            Assert.AreEqual("child2", ((Node)n.Children[1]).Label, "child 1 wrong");

            Assert.AreEqual(3, n.Children.Count, "wrong number of children");
            Assert.AreEqual("child", ((Node)n.Children[2]).Label, "child 2 wrong");

            Assert.IsFalse(((Node)n.Children[0]).IsProhibited, "child 0 is not prohibited");
            Assert.IsFalse(((Node)n.Children[1]).IsProhibited, "child 1 is not prohibited");
            Assert.IsTrue(((Node)n.Children[2]).IsProhibited, "child 2 is  prohibited");
        }
Exemple #3
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 #4
0
        public void LoadLocators()
        {
            TestPresentationLink pl = new TestPresentationLink("Statement of Financial Position - CI", "http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition");

            int errors = 0;

            TestPresentation p = new TestPresentation();

            Console.WriteLine("Using File {0}", GAAP_PRESENTATION_FILE);

            p.Load(GAAP_PRESENTATION_FILE);

            XmlNodeList pLinksList = p.TheDocument.SelectNodes(Presentation.PLINK_KEY, p.TheManager);

            if (pLinksList == null || pLinksList.Count == 0)
            {
                Assert.Fail("no nodes returned");
            }

            XmlNode plNode = pLinksList.Item(0);

            pl.LoadChildren(plNode, p.TheManager, out errors);

            Assert.AreEqual(0, errors);
            Assert.AreEqual(290, pl.locators.Count);

            //total count of prohibited mappings
            int count = 0;

            foreach (PresentationLocator ploc in pl.locators.Values)
            {
                TestPresentationLocator tpl = new TestPresentationLocator(ploc);
                count += tpl.NumProhibited();
            }


            Assert.AreEqual(8, count);
        }
        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" );
        }
 public void CreatePresentationLocator()
 {
     TestPresentationLocator pl = new TestPresentationLocator();
 }
        public void CheckOrderDiffPriority()
        {
            PresentationLocator parent	= new TestPresentationLocator( "parent", "xsd#parent" );
            ArrayList errors = new ArrayList();

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

            PresentationLocator child	= new TestPresentationLocator( "child", "xsd#child" );
            PresentationLocator child2	= new TestPresentationLocator( "child2", "xsd#child2" );
            //			PresentationLocator child3	= new TestPresentationLocator( "child_7.0_pro", "xsd#child" );

            child.ParseHRef( errors );
            //child.MyElement = new Element( "child_1.7", false );
            Assert.AreEqual( 0, errors.Count );

            child2.ParseHRef( errors );
            //child2.MyElement = new Element( "child_7.0_opt", false );
            Assert.AreEqual( 0, errors.Count );

            //child3.ParseHRef( errors );
            //child3.MyElement = new Element( "child_7.0_pro", false );
            //Assert.AreEqual( 0, errors.Count );

            PresentationLink pl = new PresentationLink("Test", "Test", new ArrayList() );
            pl.AddLocator( parent );
            pl.AddLocator( child );
            pl.AddLocator( child2 );

            parent.AddChild( child, "Label", "0", 1.7F, "label", "0", false );
            parent.AddChild( child, "Label", "0", 7.0F, "label", "0", false );
            parent.AddChild( child, "Label", "2", 7.0F, "label", "0", true );

            parent.AddChild( child2, "Label", "0", 2.0F, "label", "0", false );

            //			pl.AddLocator( child3 );

            Node n = parent.CreateNode( "en", "", "", pl );

            //should be:
            //	child (1.7)
            //	child2 (2.0)
            //  child - prohibited (7.0)

            Assert.AreEqual( "parent", n.Label, "parent expected" );
            Assert.AreEqual( "child", ((Node)n.Children[0]).Label, "child 0 wrong" );
            Assert.AreEqual( "child2", ((Node)n.Children[1]).Label, "child 1 wrong" );

            Assert.AreEqual( 3, n.Children.Count, "wrong number of children" );
            Assert.AreEqual( "child", ((Node)n.Children[2]).Label, "child 2 wrong" );

            Assert.IsFalse( ((Node)n.Children[0]).IsProhibited, "child 0 is not prohibited" );
            Assert.IsFalse( ((Node)n.Children[1]).IsProhibited, "child 1 is not prohibited" );
            Assert.IsTrue( ((Node)n.Children[2]).IsProhibited, "child 2 is  prohibited" );
        }
        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);
        }
        public void LoadLocators()
        {
            TestPresentationLink pl = new TestPresentationLink("Statement of Financial Position - CI","http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition");

            int errors = 0;

            TestPresentation p = new TestPresentation();

            Console.WriteLine( "Using File {0}", GAAP_PRESENTATION_FILE );

            p.Load( GAAP_PRESENTATION_FILE);

            XmlNodeList pLinksList = p.TheDocument.SelectNodes( Presentation.PLINK_KEY, p.TheManager );

            if ( pLinksList == null || pLinksList.Count == 0 )
            {
                Assert.Fail( "no nodes returned" );
            }

            XmlNode plNode = pLinksList.Item(0);
            pl.LoadChildren( plNode, p.TheManager, out errors );

            Assert.AreEqual( 0, errors );
            Assert.AreEqual( 290, pl.locators.Count );

            //total count of prohibited mappings
            int count = 0;
            foreach ( PresentationLocator ploc in pl.locators.Values )
            {
                TestPresentationLocator tpl = new TestPresentationLocator( ploc );
                count += tpl.NumProhibited();
            }

            Assert.AreEqual( 8, count );
        }
Exemple #10
0
 public void CreatePresentationLocator()
 {
     TestPresentationLocator pl = new TestPresentationLocator();
 }