public void CustomComparerTest2()
        {
            Wrapper2 <int, int> o1 = new Wrapper2 <int, int>(0, 1);
            Wrapper2 <int, int> o2 = new Wrapper2 <int, int>(0, 2);
            AdvancedComparer <Wrapper2 <int, int> > comparer = AdvancedComparer <Wrapper2 <int, int> > .Default;

            Assert.IsNotNull(comparer);
            AssertEx.IsPatternMatch(comparer.Implementation.GetType().Name, "Wrapper2Comparer*");
            Assert.Greater(comparer.Compare(o2, o1), 0);
        }
Exemple #2
0
        public override bool Equals(Wrapper2 <T1, T2> x, Wrapper2 <T1, T2> y)
        {
            bool r = BaseComparer1.Equals(x.Value, y.Value);

            if (r)
            {
                r = BaseComparer2.Equals(x.Value2, y.Value2);
            }
            return(r);
        }
Exemple #3
0
        public override int Compare(Wrapper2 <T1, T2> x, Wrapper2 <T1, T2> y)
        {
            int r = BaseComparer1.Compare(x.Value, y.Value);

            if (r == 0)
            {
                r = BaseComparer2.Compare(x.Value2, y.Value2);
            }
            return(r);
        }
Exemple #4
0
        public override int GetHashCode(Wrapper2 <T1, T2> obj)
        {
            int r = BaseComparer1.GetHashCode(obj.Value);

            return(r ^ BaseComparer2.GetHashCode(obj.Value2));
        }