Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }