Example #1
0
        public void GetHashCode_DifferentClasses_DifferentHash()
        {
            // Arrange
            var intValue = 317;
            var strValue = "s";
            var fooA     = new TestSettings1
            {
                IntProperty   = intValue,
                StringPropert = strValue
            };
            var fooB = new TestSettings2
            {
                IntProperty   = intValue,
                StringPropert = strValue
            };

            // Act
            var hashA = fooA.GetHashCode();
            var hashB = fooB.GetHashCode();

            // Assert
            Assert.AreNotEqual(hashA, hashB);
        }
Example #2
0
        public void Equals_DifferentClasses_False()
        {
            // Arrange
            var intValue = 317;
            var strValue = "s";
            var fooA     = new TestSettings1
            {
                IntProperty   = intValue,
                StringPropert = strValue
            };
            var fooB = new TestSettings2
            {
                IntProperty   = intValue,
                StringPropert = strValue
            };

            // Act
            var equalsAB = fooA.Equals(fooB);
            var equalsBA = fooB.Equals(fooA);

            // Assert
            Assert.IsFalse(equalsAB);
            Assert.IsFalse(equalsBA);
        }