Example #1
0
        public void CompareArraysWithDifferntValues()
        {
            var array1 = new[] { 1, 2, 3 };
            var array2 = new[] { 1, 2, 4 };

            Assert.That(DeepEqualityComparer.AreEqual(array1, array2), Is.False);
        }
Example #2
0
        public void CompareEqualArrays()
        {
            var array1 = new[] { 1, 2, 3 };
            var array2 = new[] { 1, 2, 3 };

            Assert.That(DeepEqualityComparer.AreEqual(array1, array2), Is.True);
        }
        public void CompareEqualEnumerables()
        {
            var enumerable1 = this.GetIntegerEnumeration1();
            var enumerable2 = this.GetIntegerEnumeration2();

            Assert.That(DeepEqualityComparer.AreEqual(enumerable1, enumerable2), Is.True);
        }
Example #4
0
        public void PostConcert_Returns_Concert()
        {
            var concertResponse = ConcertTestData.GetCreatedConcert();
            var response        = _controller.CreateConcert(true, _concert);

            Assert.IsTrue(DeepEqualityComparer.AreEqual(concertResponse, response.Concert));
        }
Example #5
0
        public void CompareEqualStrings()
        {
            var text1 = new StringBuilder().Append("abcd").ToString();
            var text2 = new StringBuilder().Append("abcd").ToString();

            Assert.That(DeepEqualityComparer.AreEqual(text1, text2), Is.True);
        }
        public void CompareDifferentEnumerables()
        {
            var enumerable1 = this.GetIntegerEnumeration1();
            var enumerable2 = this.GetIntegerEnumeration3();

            Assert.That(DeepEqualityComparer.AreEqual(enumerable1, enumerable2), Is.False);
        }
        public void CompareEqualInstancesOfTypesWithoutEquals()
        {
            var instance1 = new SomeType {
                Text = new string(new[] { 'T' }), Number = 12
            };
            var instance2 = new SomeType {
                Text = new string(new[] { 'T' }), Number = 12
            };

            Assert.That(DeepEqualityComparer.AreEqual(instance1, instance2), Is.True);
        }
        public void CompareDifferentInstancesOfTypesWithoutEquals()
        {
            var instance1 = new SomeType {
                Text = "T", Number = 12
            };
            var instance2 = new SomeType {
                Text = "X", Number = 12
            };

            Assert.That(DeepEqualityComparer.AreEqual(instance1, instance2), Is.False);
        }
        public void CompareStruct()
        {
            var struct1 = new SomeStruct {
                Short = 234, Value = 456
            };
            var struct2 = new SomeStruct {
                Short = 234, Value = 456
            };
            var struct3 = new SomeStruct {
                Short = -234, Value = 1456
            };

            Assert.That(DeepEqualityComparer.AreEqual(struct1, struct2), Is.True);
            Assert.That(DeepEqualityComparer.AreEqual(struct1, struct3), Is.False);
        }
 public void CompareObjectWithNull()
 {
     Assert.That(DeepEqualityComparer.AreEqual(new object(), null), Is.False);
 }
        public void CompareObjectWithItself()
        {
            var obj = new object();

            Assert.That(DeepEqualityComparer.AreEqual(obj, obj), Is.True);
        }
 public void CompareNullWithObject()
 {
     Assert.That(DeepEqualityComparer.AreEqual(null, new object()), Is.False);
 }
 public void CompareNullWithNull()
 {
     Assert.That(DeepEqualityComparer.AreEqual(null, null), Is.True);
 }
 public void CompareIntegers()
 {
     Assert.That(DeepEqualityComparer.AreEqual(1, 1), Is.True);
     Assert.That(DeepEqualityComparer.AreEqual(1, 2), Is.False);
     Assert.That(DeepEqualityComparer.AreEqual(2, 1), Is.False);
 }
 public void CompareEnum()
 {
     Assert.That(DeepEqualityComparer.AreEqual(SomeEnum.Value1, SomeEnum.Value1), Is.True);
     Assert.That(DeepEqualityComparer.AreEqual(SomeEnum.Value1, SomeEnum.Value2), Is.False);
 }