public void CompareToWithUnequalObjectTypes() { var first = new TimeMarker(1); var second = new object(); Assert.Throws <ArgumentException>(() => first.CompareTo(second)); }
public void CompareToOperatorWithEqualObjects() { var first = new TimeMarker(1); object second = new TimeMarker(1); Assert.AreEqual(0, first.CompareTo(second)); }
public void CompareToWithSmallerFirstObject() { var first = new TimeMarker(1); object second = new TimeMarker(2); Assert.IsTrue(first.CompareTo(second) < 0); }
public void CompareToWithNullObject() { var first = new TimeMarker(1); object second = null; Assert.AreEqual(1, first.CompareTo(second)); }
/// <summary> /// Compares the current instance with another object of the same type and returns an integer that /// indicates whether the current instance precedes, follows, or occurs in the same position in the /// sort order as the other object. /// </summary> /// <param name="other">An object to compare with this instance.</param> /// <returns> /// A 32-bit signed integer that indicates the relative order of the objects being compared. /// The return value has these meanings: /// Value /// Meaning /// Less than zero /// This instance is less than <paramref name="other"/>. /// Zero /// This instance is equal to <paramref name="other"/>. /// Greater than zero /// This instance is greater than <paramref name="other"/>. /// </returns> public int CompareTo(ValueAtTime <T> other) { return(m_Time.CompareTo(other.m_Time)); }