public void CompareTo_EdgeTest() { LockTime lt = new LockTime(100); object nObj = null; object sObj = "LockTime!"; Assert.Equal(1, lt.CompareTo(nObj)); Assert.Throws <ArgumentException>(() => lt.CompareTo(sObj)); }
public void Comparison_EqualTest() { LockTime first = new LockTime(1); LockTime second = new LockTime(1); Assert.False(first > second); Assert.True(first >= second); Assert.False(second < first); Assert.True(second <= first); Assert.True(first == second); Assert.False(first != second); Assert.Equal(0, first.CompareTo(second)); Assert.Equal(0, first.CompareTo((object)second)); Assert.True(first.Equals(second)); Assert.True(first.Equals((object)second)); }
public void ComparisonOperator_SameTypeTest(LockTime lt1, LockTime lt, ValueCompareResult expected) { Assert.Equal(expected.Bigger, lt1 > lt); Assert.Equal(expected.BiggerEqual, lt1 >= lt); Assert.Equal(expected.Smaller, lt1 < lt); Assert.Equal(expected.SmallerEqual, lt1 <= lt); Assert.Equal(expected.Equal, lt1 == lt); Assert.Equal(!expected.Equal, lt1 != lt); Assert.Equal(expected.Equal, lt1.Equals(lt)); Assert.Equal(expected.Equal, lt1.Equals((object)lt)); Assert.Equal(expected.Compare, lt1.CompareTo(lt)); Assert.Equal(expected.Compare, lt1.CompareTo((object)lt)); }
public void ComparisonTest() { LockTime big = new LockTime(1); LockTime small = new LockTime(0); Assert.True(big > small); Assert.True(big >= small); Assert.True(small < big); Assert.True(small <= big); Assert.False(big == small); Assert.True(big != small); Assert.Equal(1, big.CompareTo(small)); Assert.Equal(1, big.CompareTo((object)small)); Assert.Equal(-1, small.CompareTo(big)); Assert.Equal(-1, small.CompareTo((object)big)); Assert.False(big.Equals(small)); Assert.False(big.Equals((object)small)); }