Example #1
0
        public void ClientIdentifier_CompareTo_WithoutGuidIsGreaterThanWithGuid()
        {
            // Arrange
            var x = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.NewGuid());
            var y = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.Empty);
            // Act
            var result = y.CompareTo(x);

            // Assert
            Assert.AreEqual(1, result);
        }
Example #2
0
        public void ClientIdentifier_CompareTo_ReturnsNonZeroWhenNameServerAndPortAreNotEqual()
        {
            // Arrange
            var x = new ClientIdentifier("Foo", "Bar", ClientSettings.DefaultPort, Guid.Empty);
            var y = new ClientIdentifier("Fizz", "Bizz", 46330, Guid.Empty);
            // Act
            var result = x.CompareTo(y);

            // Assert
            Assert.AreNotEqual(0, result);
            Assert.IsFalse(x == y);
            Assert.IsTrue(x != y);
        }
Example #3
0
        public void ClientIdentifier_CompareTo_ReturnsNonZeroWhenGuidsAreNotEqual()
        {
            // Arrange
            var x = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.NewGuid());
            var y = new ClientIdentifier(null, null, ClientSettings.NoPort, Guid.NewGuid());
            // Act
            var result = x.CompareTo(y);

            // Assert
            Assert.AreNotEqual(0, result);
            Assert.IsFalse(x == y);
            Assert.IsTrue(x != y);
        }
Example #4
0
        public int CompareTo(SlotIdentifier other)
        {
            var ordinalComparison = Ordinal.CompareTo(other.Ordinal);

            if (ordinalComparison != 0)
            {
                return(ordinalComparison);
            }
            var clientComparison = ClientIdentifier.CompareTo(other.ClientIdentifier);

            if (clientComparison != 0)
            {
                return(clientComparison);
            }
            return(SlotID.CompareTo(other.SlotID));
        }