public void TestGetHashcode_pass()
        {
            var item1 = new EqualityHarness(true, true);
            var item2 = item1;

            Assert.That(item1.Equals(item2));
            Assert.That(item1.GetHashCode() == item2.GetHashCode());
            Assert.DoesNotThrow(() => Cush.TestGetHashCode(item1, item2));
        }
        public void TestGetHashcode_fail()
        {
            var item1 = new EqualityHarness(true, true, false);
            var item2 = item1;

            Assert.That(item1.Equals(item2));
            Assert.That(item1.GetHashCode() != item2.GetHashCode());
            Assert.Throws<AssertionException>(() => Cush.TestGetHashCode(item1, item2));
        }
Exemple #3
0
        public void TestEqualityTest_OperatorFail()
        {
            // Make sure TestEquality throws an exception when Equals() is wrong.
            var item1 = new EqualityHarness(true, false);
            var item2 = item1;
            var item3 = item1;

            Assert.That(item1 != item2);

            Assert.Throws<Assertion.Exceptions.AssertionException>(() => Cush.TestEquality(item1, item2, item3));
        }