public virtual bool Equals(ICollectionValue <T> other) { // Prepare CopyTo() var padding = 2; var expectedArray = new T[Count + 2 * padding]; CopyTo(expectedArray, padding); var actualArray = new T[other.Count + 2 * padding]; other.CopyTo(actualArray, padding); return // Properties (AllowsNull == other.AllowsNull && Count == other.Count && CountSpeed == other.CountSpeed && IsEmpty == other.IsEmpty // Pure methods && (!HasChoose || Choose().IsSameAs(other.Choose())) && (_sequenced ? expectedArray.SequenceEqual(actualArray, EqualityComparer) : expectedArray.UnsequenceEqual(actualArray, EqualityComparer)) && (_sequenced ? this.SequenceEqual(other, EqualityComparer) : this.UnsequenceEqual(other, EqualityComparer)) // Show() is tested with ToString() && (_sequenced ? ToArray().SequenceEqual(other.ToArray(), EqualityComparer) : ToArray().UnsequenceEqual(other.ToArray(), EqualityComparer)) && (!_sequenced || ToString().Equals(other.ToString()))); // TODO: Should they always return the same result? Couldn't this differ between collection types? }
/// <summary> /// /// </summary> /// <param name="format"></param> /// <param name="formatProvider"></param> /// <returns></returns> public string ToString(string format, IFormatProvider formatProvider) { return(collectionvalue.ToString(format, formatProvider)); }