Exemple #1
0
            public void ShouldNotProvideSameHashCodeWhenValuesAreDifferent()
            {
                // arrange
                var stronglyTypedId        = new GuidFor <Order>(Guid.NewGuid());
                var anotherStronglyTypedId = new GuidFor <Order>(Guid.NewGuid());

                // act
                var hashCode1 = stronglyTypedId.GetHashCode();
                var hashCode2 = anotherStronglyTypedId.GetHashCode();

                // assert
                hashCode1.Should().NotBe(hashCode2);
            }
Exemple #2
0
            public void ShouldNotProvideSameHashCodeWhenEntitiesAreDifferent()
            {
                // arrange
                var targetId               = Guid.NewGuid();
                var stronglyTypedId        = new GuidFor <Order>(targetId);
                var anotherStronglyTypedId = new GuidFor <PricePosition>(targetId);

                // act
                var hashCode1 = stronglyTypedId.GetHashCode();
                var hashCode2 = anotherStronglyTypedId.GetHashCode();

                // assert
                hashCode1.Should().NotBe(hashCode2);
            }
Exemple #3
0
            public void ShouldProvideSameHashCodeWhenValuesAndEntitiesAreEqual()
            {
                // arrange
                var targetId               = Guid.NewGuid();
                var stronglyTypedId        = new GuidFor <Order>(targetId);
                var anotherStronglyTypedId = new GuidFor <Order>(targetId);

                // act
                var hashCode1 = stronglyTypedId.GetHashCode();
                var hashCode2 = anotherStronglyTypedId.GetHashCode();

                // assert
                hashCode1.Should().Be(hashCode2);
            }