Ejemplo n.º 1
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
        /// </returns>
        protected bool Equals(ImmutableRangeList <TValue> other)
        {
            if (IsFull && other.IsFull)
            {
                return(true);
            }
            if (IsEmpty && other.IsEmpty)
            {
                return(true);
            }

            if (IsEmpty)
            {
                return(false);
            }
            if (other.IsEmpty)
            {
                return(false);
            }

            if (Values.Count != other.Values.Count)
            {
                return(false);
            }

            for (var i = 0; i < Values.Count; i++)
            {
                if (!Equals(Values[i], other.Values[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
 private static void CheckList <TValue>(ImmutableRangeList <TValue> list, string representation)
     where TValue : IComparable <TValue> =>
 Assert.AreEqual(list.DisplayValue(), representation);