public void NotEqualInstancesHaveDifferentHashCode() { // given var target = new BeaconCacheRecord(1234L, "abc"); var otherOne = new BeaconCacheRecord(4321L, "abc"); var otherTwo = new BeaconCacheRecord(1234L, "abcd"); var otherThree = new BeaconCacheRecord(1234L, "abcd"); otherThree.MarkForSending(); // then Assert.That(target.GetHashCode(), Is.Not.EqualTo(otherOne.GetHashCode())); Assert.That(target.GetHashCode(), Is.Not.EqualTo(otherTwo.GetHashCode())); Assert.That(target.GetHashCode(), Is.Not.EqualTo(otherThree.GetHashCode())); }
public void TwoEqualInstancesHaveSameHashCode() { // given var target = new BeaconCacheRecord(1234L, "abc"); var other = new BeaconCacheRecord(1234L, "abc"); // then Assert.That(target.GetHashCode(), Is.EqualTo(other.GetHashCode())); // and when marking both for sending target.MarkForSending(); other.MarkForSending(); // then Assert.That(target.GetHashCode(), Is.EqualTo(other.GetHashCode())); }
public void SameInstancesHaveSameHashCode() { // given var target = new BeaconCacheRecord(1234L, "abc"); var other = target; // then Assert.That(target.GetHashCode(), Is.EqualTo(other.GetHashCode())); }