Пример #1
0
        public void ValueObjects_WhenNotEqual_HashCodesNotEqual()
        {
            // Arrange
            var vo1 = new FakeValueObject(1, 2, 3);
            var vo2 = new FakeValueObject(2, 2, 3);

            // Act
            var hashCodesEqual = vo1.GetHashCode() == vo2.GetHashCode();

            // Assert
            hashCodesEqual.Should().BeFalse();
        }
Пример #2
0
        public void ValueObjects_AreEqual()
        {
            // Arrange
            var vo1 = new FakeValueObject(1, 2, 3);
            var vo2 = new FakeValueObject(1, 2, 3);

            // Act
            var areEqual = vo1 == vo2;

            // Assert
            areEqual.Should().BeTrue();
        }
Пример #3
0
        public void ValueObjects_WhenEqual_HaveEqualHashCodes()
        {
            // Arrange
            var vo1 = new FakeValueObject(1, 2, 3);
            var vo2 = new FakeValueObject(1, 2, 3);

            // Act
            var hashCodesEqual = vo1.GetHashCode() == vo2.GetHashCode();

            // Assert
            hashCodesEqual.Should().BeTrue();
        }