public void testComparableSameLength()
        {
            byte[]     value1      = new byte[] { (byte)0xFF, (byte)0xAB, 0x12, 0x25, 0x22, 0x25 };
            Identifier identifier1 = Identifier.FromBytes(value1, 0, value1.Length, false);

            byte[]     value2      = new byte[] { (byte)0xFF, (byte)0xAB, 0x12, 0x25, 0x11, 0x11 };
            Identifier identifier2 = Identifier.FromBytes(value2, 0, value2.Length, false);

            AssertEx.AreEqual("identifier1 is equal to identifier2", identifier1.CompareTo(identifier1), 0);
            AssertEx.AreEqual("identifier1 is larger than identifier2", identifier1.CompareTo(identifier2), 1);
            AssertEx.AreEqual("identifier2 is smaller than identifier1", identifier2.CompareTo(identifier1), -1);
        }
Exemplo n.º 2
0
        public static void CompareTo_GivenNullIdentifier_ReturnsNonZero()
        {
            var identifier = new Identifier("name", "name", "name", "test");

            var compareResult = identifier.CompareTo(null);

            Assert.That(compareResult, Is.Not.Zero);
        }
Exemplo n.º 3
0
        public static void CompareTo_GivenSameIdentifier_ReturnsZero()
        {
            var identifier = new Identifier("name", "name", "name", "test");

            var compareResult = identifier.CompareTo(identifier);

            Assert.That(compareResult, Is.Zero);
        }
Exemplo n.º 4
0
        public static void CompareTo_GivenDifferentIdentifiers_ReturnsNonZero()
        {
            var identifier      = new Identifier("name", "name", "name", "test");
            var otherIdentifier = new Identifier("name", "name", "name", "name");

            var compareResult = identifier.CompareTo(otherIdentifier);

            Assert.That(compareResult, Is.Not.Zero);
        }
Exemplo n.º 5
0
        public int CompareTo(GraphNode <T> other)
        {
            if (other == null)
            {
                return(-1);
            }

            return(Identifier.CompareTo(other.Identifier));
        }
Exemplo n.º 6
0
        public int CompareTo(Partition other)
        {
            if (other == null)
            {
                return(1);
            }

            return(Identifier.CompareTo(other.Identifier));
        }
Exemplo n.º 7
0
        public int CompareTo(ExtendedDetail other)
        {
            var compared = Index.CompareTo(other.Index);

            if (compared != 0)
            {
                return(compared);
            }
            return(Identifier.CompareTo(other.Identifier));
        }
Exemplo n.º 8
0
        public void CompareTo_WhenIdentifiersCompared_ItReturnsExpectedResult(object left, object right, int expectedResult)
        {
            // Arrange
            var identifierLeft  = new Identifier(left);
            var identifierRight = new Identifier(right);

            // Act
            var result = identifierLeft.CompareTo(identifierRight);

            // Assert
            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 9
0
        public int CompareTo(object obj)
        {
            ClientInformation otherClientInfo = obj as ClientInformation;

            if (otherClientInfo != null)
            {
                return(Identifier.CompareTo(otherClientInfo.Identifier));
            }
            else
            {
                throw new ArgumentException("Object is not a ClientInfo");
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Compares the current instance to the object.
        /// </summary>
        public int CompareTo(object obj)
        {
            // check for null.
            if (Object.ReferenceEquals(obj, null))
            {
                return(-1);
            }

            // check for reference comparisons.
            if (Object.ReferenceEquals(this, obj))
            {
                return(0);
            }

            string id = obj as string;

            if (id == null)
            {
                NodeId nodeId = obj as NodeId;

                if (nodeId != null)
                {
                    id = nodeId.Identifier;
                }
                else
                {
                    ExpandedNodeId expandedNodeId = obj as ExpandedNodeId;

                    if (expandedNodeId != null)
                    {
                        id = expandedNodeId.Identifier;
                    }
                }
            }

            if (id == null)
            {
                return((Identifier != null)?-1:0);
            }

            if (Identifier != null)
            {
                return(Identifier.CompareTo(id));
            }

            return(+1);
        }
 public int CompareTo(M12ControlCode other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 12
0
 public int CompareTo(TokenKey other)
 {
     return(type.CompareTo(other.Type) * 2 + Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 13
0
 /// <default>
 ///     <summary>
 ///     Comparer to sort the a list with SDTypes.
 ///     </summary>
 ///     <param name="other">SDType to compare with</param>
 ///     <returns>A value indicating, if the current SDType is lower or greater then the given one.</returns>
 /// </default>
 /// <de>
 ///     <summary>
 ///     Vergleichsmethode, um eine Liste mit <c>SDType</c>s zu sortieren.
 ///     </summary>
 ///     <param name="other">Ein anderer <c>SDType</c> mit dem dieser verglichen werden soll.</param>
 ///     <returns>Ein Wert der angibt, ob der aktuelle <c>SDType</c> "größer" oder "kleiner" als der angegebene ist.</returns>
 /// </de>
 public int CompareTo(SDType other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 14
0
 /// <default>
 ///     <summary>
 ///     Comparer to sort the a list with SDMembers.
 ///     </summary>
 ///     <param name="other">SDMemberBase to compare with</param>
 ///     <returns>A value indicating, if the current SDMemberBase is lower or greater then the given one.</returns>
 /// </default>
 /// <de>
 ///     <summary>
 ///     Vergleichsmethode, um eine Liste mit <c>SDMemberBase</c>s zu sortieren.
 ///     </summary>
 ///     <param name="other">Ein anderer <c>SDMemberBase</c> mit dem dieser verglichen werden soll.</param>
 ///     <returns>Ein Wert der angibt, ob der aktuelle <c>SDMemberBase</c> "größer" oder "kleiner" als der angegebene ist.</returns>
 /// </de>
 public int CompareTo(SDMemberBase other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 15
0
        public int CompareTo(object obj)
        {
            DTProject other = (DTProject)obj;

            return(Identifier.CompareTo(other.Identifier));
        }
Exemplo n.º 16
0
 /// <default>
 ///     <summary>
 ///     Comparer to sort the a list with SDNamespaces.
 ///     </summary>
 ///     <param name="other">SDNamespace to compare with</param>
 ///     <returns>A value indicating, if the current SDNamespace is lower or greater then the given one.</returns>
 /// </default>
 /// <de>
 ///     <summary>
 ///     Vergleichsmethode, um eine Liste mit <c>SDNamespace</c>s zu sortieren.
 ///     </summary>
 ///     <param name="other">Ein anderer <c>SDNamespace</c> mit dem dieser verglichen werden soll.</param>
 ///     <returns>Ein Wert der angibt, ob der aktuelle <c>SDNamespace</c> "größer" oder "kleiner" als der angegebene ist.</returns>
 /// </de>
 public int CompareTo(SDNamespace other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 17
0
 public int CompareTo(object other)
 {
     return(Identifier.CompareTo(((Sensor)other).Identifier));
 }
Exemplo n.º 18
0
 /// <default>
 ///     <summary>
 ///     Comparer to sort the a list with SDTargetFxs.
 ///     </summary>
 ///     <param name="other">SDTargetFx to compare with</param>
 ///     <returns>A value indicating, if the current SDTargetFx is lower or greater then the given one.</returns>
 /// </default>
 /// <de>
 ///     <summary>
 ///     Vergleichsmethode, um eine Liste mit <c>SDTargetFx</c>s zu sortieren.
 ///     </summary>
 ///     <param name="other">Ein anderer <c>SDTargetFx</c> mit dem dieser verglichen werden soll.</param>
 ///     <returns>Ein Wert der angibt, ob der aktuelle <c>SDType</c> "größer" oder "kleiner" als der angegebene ist.</returns>
 /// </de>
 public int CompareTo(SDTargetFx other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }
Exemplo n.º 19
0
 public int CompareTo(State <T> other)
 {
     return(Identifier.CompareTo(other.Identifier));
 }