Пример #1
0
        public void GetHashCode_ConsidersPublicFields()
        {
            var value1 = new TestValue {
                Property2 = 2
            };
            var value2 = new TestValue {
                Property2 = 2, Field = 4
            };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #2
0
        public void GetHashCode_NotEqualForDistinctObjects_2()
        {
            var value1 = new TestValue {
                Property1 = "string", Property2 = 4
            };
            var value2 = new TestValue {
                Property1 = "String", Property2 = 4
            };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #3
0
        public void GetHashCode_HandlesNull()
        {
            var value1 = new TestValue {
                Property2 = 2
            };
            var value2 = new TestValue {
                Property2 = 5
            };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #4
0
        public void GetHashCode_AlwaysEqualForEqualObjects()
        {
            var value1 = new TestValue {
                Property1 = "string", Property2 = 4
            };
            var value2 = new TestValue {
                Property1 = "string", Property2 = 4
            };

            Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #5
0
        public void GetHashCode_ConsidersPublicFields()
        {
            var value1 = new TestValue { Property2 = 2 };
            var value2 = new TestValue { Property2 = 2, Field = 4 };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #6
0
        public void GetHashCode_AlwaysEqualForEqualObjects()
        {
            var value1 = new TestValue { Property1 = "string", Property2 = 4 };
            var value2 = new TestValue { Property1 = "string", Property2 = 4 };

            Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #7
0
        public void GetHashCode_NotEqualForDistinctObjects_2()
        {
            var value1 = new TestValue { Property1 = "string", Property2 = 4 };
            var value2 = new TestValue { Property1 = "String", Property2 = 4 };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }
Пример #8
0
        public void GetHashCode_HandlesNull()
        {
            var value1 = new TestValue { Property2 = 2 };
            var value2 = new TestValue { Property2 = 5 };

            Assert.AreNotEqual(value1.GetHashCode(), value2.GetHashCode());
        }