public override int GetHashCode() { unchecked { var hashCode = Ordinal; hashCode = (hashCode * 397) ^ ClientIdentifier.GetHashCode(); hashCode = (hashCode * 397) ^ SlotID; return(hashCode); } }
public void ClientIdentifier_AreNotEqualWhenNameServerPortAreNotEqualWithNoGuid() { // Arrange var x = new ClientIdentifier("Foo", "Bar", ClientSettings.DefaultPort, Guid.Empty); var y = new ClientIdentifier("Fizz", "Bizz", 46330, Guid.Empty); // Act var result = x.Equals(y) | x.GetHashCode() == y.GetHashCode(); // Assert Assert.IsFalse(result); }
public void ClientIdentifier_AreNotEqualWhenGuidsAreNotEqual() { // Arrange var x = new ClientIdentifier("Foo", "Bar", ClientSettings.DefaultPort, Guid.NewGuid()); var y = new ClientIdentifier("Foo", "Bar", ClientSettings.DefaultPort, Guid.NewGuid()); // Act var result = x.Equals(y) | x.GetHashCode() == y.GetHashCode(); // Assert Assert.IsFalse(result); }
public void ClientIdentifier_AreNotEqualWhenSecondHasGuid() { // Arrange var x = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.Empty); var y = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.NewGuid()); // Act var result = x.Equals(y) | x.GetHashCode() == y.GetHashCode(); // Assert Assert.IsFalse(result); }
public void ClientIdentifier_AreEqualWhenGuidsAreEqual() { // Arrange var guid = Guid.NewGuid(); var x = new ClientIdentifier("Foo", "Bar", ClientSettings.DefaultPort, guid); var y = new ClientIdentifier("Fizz", "Bizz", 46330, guid); // Act var result = x.Equals(y) & x.GetHashCode() == y.GetHashCode(); // Assert Assert.IsTrue(result); }