Пример #1
0
        public void EquivalentObjects_SameHashCodes()
        {
            // Arrange
            var baseObjectA = new ValueObjectScenarios.BaseObject();
            var baseObjectB = new ValueObjectScenarios.BaseObject();

            // Act
            var hashCodeA = baseObjectA.GetHashCode();
            var hashCodeB = baseObjectB.GetHashCode();

            // Assert
            hashCodeA.Should().Be(hashCodeB);
        }
Пример #2
0
        public void DifferentObjects_DifferentHashCodes()
        {
            // Arrange
            var baseObject    = new ValueObjectScenarios.BaseObject();
            var derivedObject = new ValueObjectScenarios.DerivedObject();

            // Act
            var baseObjectHashCode    = baseObject.GetHashCode();
            var derivedObjectHashCode = derivedObject.GetHashCode();

            // Assert
            baseObjectHashCode.Should().NotBe(derivedObjectHashCode);
        }