コード例 #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();
        }