public void ShouldNotProvideSameHashCodeWhenValuesAreDifferent() { // arrange var stronglyTypedId = new IdFor <Order, Guid>(Guid.NewGuid()); var anotherStronglyTypedId = new IdFor <Order, Guid>(Guid.NewGuid()); // act var hashCode1 = stronglyTypedId.GetHashCode(); var hashCode2 = anotherStronglyTypedId.GetHashCode(); // assert hashCode1.Should().NotBe(hashCode2); }
public void ShouldNotProvideSameHashCodeWhenEntitiesAreDifferent() { // arrange var targetId = Guid.NewGuid(); var stronglyTypedId = new IdFor <Order, Guid>(targetId); var anotherStronglyTypedId = new IdFor <PricePosition, Guid>(targetId); // act var hashCode1 = stronglyTypedId.GetHashCode(); var hashCode2 = anotherStronglyTypedId.GetHashCode(); // assert hashCode1.Should().NotBe(hashCode2); }
public void ShouldProvideSameHashCodeWhenValuesAndEntitiesAreEqual() { // arrange var targetId = Guid.NewGuid(); var stronglyTypedId = new IdFor <Order, Guid>(targetId); var anotherStronglyTypedId = new IdFor <Order, Guid>(targetId); // act var hashCode1 = stronglyTypedId.GetHashCode(); var hashCode2 = anotherStronglyTypedId.GetHashCode(); // assert hashCode1.Should().Be(hashCode2); }