Exemplo n.º 1
0
        public void TestVeryComplex(int seedX, int seedY)
        {
            VeryComplexClass x = new VeryComplexClass(seedX);
            VeryComplexClass y = new VeryComplexClass(seedY);

            Assert.Equal(x.Equals(y), LazyEquality.Equals(x, y));
        }
Exemplo n.º 2
0
        public void TestNotEqualToHashSet(string xs, string ys)
        {
            IEnumerable <char> x = xs;
            IEnumerable <char> y = new HashSet <char>(ys);

            Assert.False(LazyEquality.Equals(x, y));
        }
Exemplo n.º 3
0
        public void TestDifferentEnumerables(string xs, string ys)
        {
            IEnumerable <char> x = xs.ToList();
            IEnumerable <char> y = new LinkedList <char>(ys);

            Assert.Equal(xs == ys, LazyEquality.Equals(x, y));
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine(new SomeClass(1, 2) == new SomeClass(1, 2));
            Console.WriteLine(new SomeClass(1, 2) == new SomeClass(1, 3));
            Console.WriteLine(new SomeClass(1, 2, 3, 3) == new SomeClass(1, 2, 3, 4));
            Console.WriteLine(new SomeClass(1, 2, 3, 3) == new SomeClass(1, 2, 3, 3));
            Console.WriteLine(new SomeClass(1, 2, 5, 5) == new SomeClass(1, 3, 5, 5));

            Console.WriteLine(LazyEquality.Equals <IEnumerable>(new ArrayList(new[] { 1, 2, 3 }), (new[] { 1, 2, 3 })));
            Console.WriteLine(LazyEquality.Equals(new ArrayList(new[] { 1, 2, 3 }), new ArrayList(new[] { 1, 2, 4 })));
        }
Exemplo n.º 5
0
        public void TestMemberwiseLists(int[] seedsX, int[] seedsY)
        {
            var x = new LinkedList <ComplexClassWithInts>(
                seedsX.Select(z => new ComplexClassWithInts(new Random(z)))
                );

            var y = new LinkedList <ComplexClassWithInts>(
                seedsY.Select(z => new ComplexClassWithInts(new Random(z)))
                );

            Assert.Equal(x.SequenceEqual(y), LazyEquality.Equals(x, y));
        }
Exemplo n.º 6
0
 public bool Equals(NativeEquatableWrapper other) => LazyEquality.Equals(this, other);
Exemplo n.º 7
0
 public void TestEnum(SomeEnum x, SomeEnum y)
 {
     Assert.Equal(x == y, LazyEquality.Equals(x, y));
 }
Exemplo n.º 8
0
 public void TestInterfaced(int x, int y)
 {
     Assert.Equal(x == y, LazyEquality.Equals(new LazyIEquatableClass(x), new LazyIEquatableClass(y)));
 }
 public bool Equals(LazyIEquatableClass other) => LazyEquality.Equals(this, other);
Exemplo n.º 10
0
 public override bool Equals(object obj) => LazyEquality.Equals(this, obj as SomeClass);
Exemplo n.º 11
0
 public static bool operator ==(SomeClass x, SomeClass y) => LazyEquality.Equals(x, y);