Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Ordinal;
         hashCode = (hashCode * 397) ^ ClientIdentifier.GetHashCode();
         hashCode = (hashCode * 397) ^ SlotID;
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }