Exemple #1
0
        public void CompareToWithSmallerFirstObject()
        {
            var    first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            object second = new ValueAtTime <int>(new TimeMarker(20), 10);

            Assert.IsTrue(first.CompareTo(second) < 0);
        }
Exemple #2
0
        public void LargerThanOperatorWithEqualObjects()
        {
            var first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            var second = new ValueAtTime <int>(new TimeMarker(10), 10);

            Assert.IsFalse(first > second);
        }
Exemple #3
0
        public void CompareToWithUnequalObjectTypes()
        {
            var first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            var second = new object();

            Assert.Throws <ArgumentException>(() => first.CompareTo(second));
        }
Exemple #4
0
        public void CompareToOperatorWithEqualObjects()
        {
            var    first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            object second = new ValueAtTime <int>(new TimeMarker(10), 10);

            Assert.AreEqual(0, first.CompareTo(second));
        }
Exemple #5
0
        public void CompareToWithNullObject()
        {
            var    first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            object second = null;

            Assert.AreEqual(1, first.CompareTo(second));
        }
Exemple #6
0
        public void SmallerThanOperatorWithFirstObjectSmaller()
        {
            var first  = new ValueAtTime <int>(new TimeMarker(10), 10);
            var second = new ValueAtTime <int>(new TimeMarker(20), 10);

            Assert.IsTrue(first < second);
        }
Exemple #7
0
 protected override ValueAtTime <int> Copy(ValueAtTime <int> original)
 {
     return(new ValueAtTime <int>(original.Time, original.Value));
 }
Exemple #8
0
 public bool Equals(ValueAtTime <T> other)
 {
     return(m_Time == other.m_Time);
 }
Exemple #9
0
 /// <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));
 }