public void OperatorGreaterThan()
        {
            TestInt?iNull = null;
            TestInt i1    = new TestInt(1);
            TestInt i1b   = new TestInt(1);
            TestInt i2    = new TestInt(2);

            Assert.IsTrue(ComparableImpl.OperatorGreaterThan(i1, iNull));
            Assert.IsFalse(ComparableImpl.OperatorGreaterThan(iNull, i1));
            Assert.IsFalse(ComparableImpl.OperatorGreaterThan(i1, i1));
            Assert.IsFalse(ComparableImpl.OperatorGreaterThan(i1, i1b));
            Assert.IsFalse(ComparableImpl.OperatorGreaterThan(i1, i2));
            Assert.IsTrue(ComparableImpl.OperatorGreaterThan(i2, i1));
        }
示例#2
0
        public void OperatorLessThanOrEqual()
        {
            TestInt?iNull = null;
            var     i1    = new TestInt(1);
            var     i1b   = new TestInt(1);
            var     i2    = new TestInt(2);

            Assert.IsTrue(ComparableImpl.OperatorLessThanOrEqual(iNull, i1));
            Assert.IsFalse(ComparableImpl.OperatorLessThanOrEqual(i1, iNull));
            Assert.IsTrue(ComparableImpl.OperatorLessThanOrEqual(i1, i1));
            Assert.IsTrue(ComparableImpl.OperatorLessThanOrEqual(i1, i1b));
            Assert.IsTrue(ComparableImpl.OperatorLessThanOrEqual(i1, i2));
            Assert.IsFalse(ComparableImpl.OperatorLessThanOrEqual(i2, i1));
        }
 public int CompareTo(object?obj)
 {
     return(ComparableImpl.CompareToObject(this, obj));
 }
示例#4
0
 int IComparable.CompareTo(object obj)
 {
     return(ComparableImpl.CompareToObject(this, obj));
 }