public void ComparerEquals_ShouldThrow_AssertFailed_When_SecondEqualsDefault()
        {
            //if (comparer.Equals(default(T), second))
            //    throw new AssertFailedException("Expected comparer.Equals(default(T), T second) to return false.");

            var first = new FakedEquality(true, true, false, false);
            var second = new FakedEquality(false, true);
            var third = FakedEquality.Empty;

            AssertComparerEquals(FakedEquality.Comparer, first, second, third,
                "Expected comparer.Equals(default(T), T second) to return false.");
        }
        public void ComparerEquals_ShouldThrow_AssertFailed_When_FirstUnequalsSecond()
        {
            //if (!comparer.Equals(first, second))
            //    throw new AssertFailedException("Expected comparer.Equals(T first, T second) to return true.");

            var first = new FakedEquality(true, false);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertComparerEquals(FakedEquality.Comparer, first, second, third,
                "Expected comparer.Equals(T first, T second) to return true.");
        }
        public void OperatorUnequals_ShouldThrow_AssertFailed_When_FirstUnequalsFirst()
        {
            //if (!GetBoolResult(op_inequality, first, first))
            //    throw new AssertFailedException("Expected (first != first) to return false.");

            var first = new FakedEquality(false);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertUnqualsOperator(first, second, third, "Expected (first != first) to return false.");
        }
        public void OperatorEquals_ShouldThrow_AssertFailed_When_FirstEqualsThird()
        {
            //if (GetBoolResult(op_equality, first, third))
            //    throw new AssertFailedException("Expected (first == third) to return false.");

            var first = new FakedEquality(true, true, true);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertEqualsOperator(first, second, third, "Expected (first == third) to return false.");
        }
        public void GetHashCode_ShouldThrow_AssertFailed_When_SecondEqualsThird()
        {
            //if (second.GetHashCode() == third.GetHashCode())
            //    throw new AssertFailedException("Expected second.GetHashCode() to be not equal to third.GetHashCode().");

            var first = new FakedEquality(1);
            var second = new FakedEquality(1, 3);
            var third = new FakedEquality(3);

            AssertHashCode(first, second, third, "Expected second.GetHashCode() to be not equal to third.GetHashCode().");
        }
        public void ComparerGetHashCode_ShouldThrow_AssertFailed_When_HashCodeIsZero()
        {
            var first = new FakedEquality(1, 1, 0);
            var second = new FakedEquality(1, 1);
            var third = new FakedEquality(3);

            AssertComparerHashCode(FakedEquality.Comparer, first, second, third,
                "Expected comparer.GetHashCode(first) not to be equal to zero (0).");
        }
        private static void AssertEqualsGeneric(FakedEquality first, FakedEquality second, FakedEquality third,
            string expectedMessage)
        {
            Action assert = () => GenericEqualsAsserter.AssertGenericEquals(first, second, third);

            assert.ShouldThrow<AssertFailedException>().WithMessage(expectedMessage);
        }
        public void EqualsObject_ShouldThrow_AssertFailed_When_FirstEqualsObject()
        {
            //if (first.Equals(new object()))
            //    throw new AssertFailedException("Expected first.Equals(new object()) to return false.");

            var first = new FakedEquality(true, true, false, false, true);
            var second = new FakedEquality(false);
            var third = FakedEquality.Empty;

            AssertEqualsObject(first, second, third, "Expected first.Equals(new object()) to return false.");
        }
        public void EqualsObject_ShouldThrow_AssertFailed_When_FirstUnequalsSecond()
        {
            //if (!first.Equals(second))
            //    throw new AssertFailedException("Expected first.Equals((object) second) to return true.");

            var first = new FakedEquality(true, false);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertEqualsObject(first, second, third, "Expected first.Equals((object) second) to return true.");
        }
        public void EqualsGeneric_ShouldThrow_AssertFailed_When_FirstEqualsThird()
        {
            //if (first.Equals((T)third))
            //    throw new AssertFailedException("Expected first.Equals<T>(T third) to return false.");

            var first = new FakedEquality(true, true, true);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertEqualsGeneric(first, second, third, "Expected first.Equals<T>(T third) to return false.");
        }
        public void EqualsGeneric_ShouldThrow_AssertFailed_When_FirstUnequalsFirst()
        {
            //if (!first.Equals((T)first))
            //    throw new AssertFailedException("Expected first.Equals<T>(T first) to return true.");

            var first = new FakedEquality(false);
            var second = FakedEquality.Empty;
            var third = FakedEquality.Empty;

            AssertEqualsGeneric(first, second, third, "Expected first.Equals<T>(T first) to return true.");
        }
        public void EqualsGeneric_ShouldNotThrow_When_ThirdIsNull()
        {
            var first = new FakedEquality(false);
            var second = new FakedEquality(true);
            //FakedEquality third = new FakedEquality(false);

            Action assert = () => GenericEqualsAsserter.AssertGenericEquals(first, second, null);

            assert.ShouldNotThrow();
        }
        public void EqualsGeneric_ShouldNotThrow_When_FirstIsNull()
        {
            //FakedEquality first = new FakedEquality(false);
            var second = new FakedEquality(true);
            var third = new FakedEquality(false);

            Action assert = () => GenericEqualsAsserter.AssertGenericEquals(null, second, third);

            assert.ShouldNotThrow();
        }
        public void ComparerGetHashCode_ShouldThrow_AssertFailed_When_SecondEqualsThird()
        {
            //if (comparer.GetHashCode(second) == comparer.GetHashCode(third))
            //    throw new AssertFailedException("Expected comparer.GetHashCode(second) to be not equal to comparer.GetHashCode(third).");

            var first = new FakedEquality(1);
            var second = new FakedEquality(1, 3);
            var third = new FakedEquality(3);

            AssertComparerHashCode(FakedEquality.Comparer, first, second, third,
                "Expected comparer.GetHashCode(second) to be not equal to comparer.GetHashCode(third).");
        }
        public void OperatorUnequals_ShouldThrow_AssertFailed_When_SecondEqualsThird()
        {
            //if (!GetBoolResult(op_inequality, second, third))
            //    throw new AssertFailedException("Expected (second != third) to return true.");

            var first = new FakedEquality(true, true, false);
            var second = new FakedEquality(true);
            var third = FakedEquality.Empty;

            AssertUnqualsOperator(first, second, third, "Expected (second != third) to return true.");
        }
        public void EqualsObject_ShouldThrow_AssertFailed_When_SecondEqualsThird()
        {
            //if (second.Equals(third))
            //    throw new AssertFailedException("Expected second.Equals((object) third) to return false.");

            var first = new FakedEquality(true, true, false);
            var second = new FakedEquality(true);
            var third = FakedEquality.Empty;

            AssertEqualsObject(first, second, third, "Expected second.Equals((object) third) to return false.");
        }
        private static void AssertComparerHashCode(IEqualityComparer<FakedEquality> comparer, FakedEquality first,
            FakedEquality second, FakedEquality third, string expectedMessage)
        {
            Action assert = () => EqualityComparerAsserter.AssertComparerGetHashCode(comparer, first, second, third);

            assert.ShouldThrow<AssertFailedException>().WithMessage(expectedMessage);
        }
        public void GetHashCode_ShouldThrow_AssertFailed_When_FirstDiffersFromSecond()
        {
            //if (first.GetHashCode() != second.GetHashCode())
            //      throw new AssertFailedException("Expected first.GetHashCode() to be equal to second.GetHashCode().");

            var first = new FakedEquality(1);
            var second = new FakedEquality(2);
            var third = new FakedEquality(3);

            AssertHashCode(first, second, third, "Expected first.GetHashCode() to be equal to second.GetHashCode().");
        }
        private static void AssertHashCode(FakedEquality first, FakedEquality second, FakedEquality third,
            string expectedMessage)
        {
            Action assert = () => EqualsObjectAsserter.AssertGetHashCode(first, second, third);

            assert.ShouldThrow<AssertFailedException>().WithMessage(expectedMessage);
        }
        public void GetHashCode_ShouldThrow_AssertFailed_When_HashCodeIsZero()
        {
            //if (first.GetHashCode() == 0)
            //      throw new AssertFailedException("Expected first.GetHashCode() not to be equal to zero (0).");

            var first = new FakedEquality(1, 1, 0);
            var second = new FakedEquality(1, 1);
            var third = new FakedEquality(3);

            AssertHashCode(first, second, third, "Expected first.GetHashCode() not to be equal to zero (0).");
        }
        private static void AssertUnqualsOperator(FakedEquality first, FakedEquality second, FakedEquality third,
            string expectedMessage)
        {
            Action assert = () => EqualityOperatorAsserter.AssertOperatorInequality(first, second, third);

            assert.ShouldThrow<AssertFailedException>().WithMessage(expectedMessage);
        }
        public void ComparerGetHashCode_ShouldThrow_AssertFailed_When_FirstDiffersFromSecond()
        {
            //if (comparer.GetHashCode(first) != comparer.GetHashCode(second))
            //    throw new AssertFailedException("Expected comparer.GetHashCode(first) to be equal to comparer.GetHashCode(second).");

            var first = new FakedEquality(1);
            var second = new FakedEquality(2);
            var third = new FakedEquality(3);

            AssertComparerHashCode(FakedEquality.Comparer, first, second, third,
                "Expected comparer.GetHashCode(first) to be equal to comparer.GetHashCode(second).");
        }