Exemple #1
0
        public static void AreDifferentWhenSecondItemIsDifferent()
        {
            var left = new Target
            {
                _field    = "test",
                Property1 = new ReferenceStruct {
                    Property1 = 5, Property2 = "test"
                },
            };

            var right = new Target
            {
                _field    = "test",
                Property1 = new ReferenceStruct {
                    Property1 = 5, Property2 = "Test"
                },
            };

            Assert.NotEqual(left, right);
            Assert.NotEqual(left.GetHashCode(), right.GetHashCode());
        }
Exemple #2
0
        public static void AreEqualWhenAllPropertiesAreEqual()
        {
            var left = new Target
            {
                _field    = "test",
                Property1 = new ReferenceStruct {
                    Property1 = 5, Property2 = "test"
                },
            };

            var right = new Target
            {
                _field    = "test",
                Property1 = new ReferenceStruct {
                    Property1 = 5, Property2 = "test"
                },
            };

            Assert.Equal(left, right);
            Assert.Equal(left.GetHashCode(), right.GetHashCode());
        }