public void StructTypeTests()
        {
            var dateComparer = new DeepEqualityComparer <DateTime>();

            Assert.True(dateComparer.Equals(new DateTime(1900, 1, 1), new DateTime(1900, 1, 1)));
            Assert.False(dateComparer.Equals(new DateTime(2020, 1, 1), new DateTime(1900, 1, 1)));

            var intComparer = new DeepEqualityComparer <int?>();

            Assert.True(intComparer.Equals(3, 3));
            Assert.True(intComparer.Equals(null, null));
            Assert.False(intComparer.Equals(3, 2));
            Assert.False(intComparer.Equals(3, null));

            var structComparer = new DeepEqualityComparer <TestStruct>();

            Assert.True(structComparer.Equals(new TestStruct {
            }, new TestStruct {
            }));
            Assert.True(structComparer.Equals(new TestStruct {
                X = "Test", Y = 1
            }, new TestStruct {
                X = "Test", Y = 1
            }));
            Assert.False(structComparer.Equals(new TestStruct {
                X = "False", Y = 1
            }, new TestStruct {
                X = "Test", Y = 0
            }));
        }
        public void ValueTypeTests()
        {
            var intComparer = new DeepEqualityComparer <int>();

            Assert.True(intComparer.Equals(3, 3));
            Assert.False(intComparer.Equals(3, 2));
        }
        public void CyclicTypeTests()
        {
            var cyclicComparer = new DeepEqualityComparer <CyclicClass>();

            var expected = new CyclicClass()
            {
                X     = "Test",
                Child = new CyclicClass()
                {
                    X = "AnotherTest",
                },
            };

            expected.Child.Parent = expected;

            var actual = new CyclicClass()
            {
                X     = "Test",
                Child = new CyclicClass()
                {
                    X = "AnotherTest",
                },
            };

            actual.Child.Parent = actual;

            Assert.True(cyclicComparer.Equals(actual, expected));

            actual.Child.X = "AnotherTest2";

            Assert.False(cyclicComparer.Equals(actual, expected));
        }
        public void StringTypeTests()
        {
            var stringComparer = new DeepEqualityComparer <string>();

            Assert.True(stringComparer.Equals("Test", "Test"));
            Assert.False(stringComparer.Equals("Test", "Wrong"));

            var stringBuilder = new StringBuilder();

            stringBuilder.Append("Te");
            stringBuilder.Append("st");

            Assert.True(stringComparer.Equals("Test", stringBuilder.ToString()));
        }
        public void ReferenceTypeTests()
        {
            var referenceComparer = new DeepEqualityComparer <TestClass>();

            Assert.True(referenceComparer.Equals(new TestClass {
            }, new TestClass {
            }));
            Assert.True(referenceComparer.Equals(new TestClass {
                X = "Test", Y = 1
            }, new TestClass {
                X = "Test", Y = 1
            }));
            Assert.False(referenceComparer.Equals(new TestClass {
                X = "False", Y = 1
            }, new TestClass {
                X = "Test", Y = 0
            }));
        }