Esempio n. 1
0
        public void Test_ElementsNotEqual()
        {
            Element p1 = new Element( "p1_id", "parent_name", "subst1" );
            Element p2 = new Element( "p2_id", "parent_name", "subst1" );

            Assert.IsFalse( p1.Equals( p2 ), "p1 == p2" );

            Element p3 = new Element( "p3_id", "parent_name", "subst1" );
            Element p4 = new Element( "p3_id", "parent_name2", "subst1" );

            Assert.IsFalse( p3.Equals( p4 ), "p3 == p4" );

            Element p5 = new Element( "p5_id", "parent_name", "subst1" );
            Element p6 = new Element( "p5_id", "parent_name", "subst2" );

            Assert.IsFalse( p5.Equals( p6 ), "p5 == p6" );

            Element p7 = new Element( "p7_id", "parent_name", "subst1" );
            p7.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );

            Element p8 = new Element( "p7_id", "parent_name", "subst1" );
            p8.AddOptionals( "type4", false, PeriodType.duration, BalanceType.credit, false );

            Assert.IsFalse( p7.Equals( p8 ), "p7 == p8" );

            Element p9 = new Element( "p9_id", "parent_name", "subst1" );
            p9.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );

            Element p10 = new Element( "p9_id", "parent_name", "subst1" );
            p10.AddOptionals( "type3", true, PeriodType.duration, BalanceType.credit, false );

            Assert.IsFalse( p9.Equals( p10 ), "p9 == p10" );

            Element p11 = new Element( "p11_id", "parent_name", "subst1" );
            p11.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );

            Element p12 = new Element( "p11_id", "parent_name", "subst1" );
            p12.AddOptionals( "type3", false, PeriodType.instant, BalanceType.credit, false );

            Assert.IsFalse( p11.Equals( p12 ), "p11 == p12" );

            Element p13 = new Element( "p13_id", "parent_name", "subst1" );
            p13.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );

            Element p14 = new Element( "p13_id", "parent_name", "subst1" );
            p14.AddOptionals( "type3", false, PeriodType.duration, BalanceType.debit, false );

            Assert.IsFalse( p13.Equals( p14 ), "p13 == p14" );

            Element p15 = new Element( "p15_id", "parent_name", "subst1" );
            p15.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );

            Element p16 = new Element( "p15_id", "parent_name", "subst1" );
            p16.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, true );

            Assert.IsFalse( p15.Equals( p16 ), "p15 == p16" );

            Element p17 = new Element( "p17_id", "parent_name", "subst1" );
            p17.AddChild( p1 );

            Element p18 = new Element( "p17_id", "parent_name", "subst1" );

            Assert.IsFalse( p17.Equals( p18 ), "p17 == p18" );

            Element p19 = new Element( "p19_id", "parent_name", "subst1" );
            p19.AddChild( p1 );

            Element p20 = new Element( "p19_id", "parent_name", "subst1" );
            p20.AddChild( p2 );

            Assert.IsFalse( p19.Equals( p20 ), "p19 == p20" );

            // c1 is considered the same element even though it has different parents
            Element c1 = new Element( "c1" );
            Element p21 = new Element( "p21_id", "parent_name", "subst1" );
            p21.AddChild( c1 );

            Element c2 = new Element( "c1" );
            Element p22 = new Element( "p21_id", "parent_name", "subst1" );
            p22.AddChild( c2 );

            Assert.IsTrue( c1.Equals( c2 ), "c1 != c2" );
        }
Esempio n. 2
0
        public void Test_ElementsEqual()
        {
            Element p1 = new Element( "p1_id", "parent_name", "subst1" );
            p1.AddOptionals( "type1", false, PeriodType.duration, BalanceType.credit, false );
            Element p2 = new Element( "p1_id", "parent_name", "subst1" );
            p2.AddOptionals( "type1", false, PeriodType.duration, BalanceType.credit, false );

            Assert.IsTrue( p1.Equals( p2 ), "p1 != P2" );

            Element p3 = new Element( "p3_id", "parent_name", "subst1" );
            p3.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );
            p3.AddChild( p1 );

            Element p4 = new Element( "p3_id", "parent_name", "subst1" );
            p4.AddOptionals( "type3", false, PeriodType.duration, BalanceType.credit, false );
            p4.AddChild( p1 );

            Assert.IsTrue( p3.Equals( p4 ), "p3 != p4" );
        }