コード例 #1
0
        public void CompareToWithUnequalObjectTypes()
        {
            MockId first  = new MockId(10);
            object second = new object();

            Assert.Throws <ArgumentException>(() => first.CompareTo(second));
        }
コード例 #2
0
        public void CompareToOperatorWithEqualObjects()
        {
            MockId first  = new MockId(10);
            object second = new MockId(10);

            Assert.AreEqual(0, first.CompareTo(second));
        }
コード例 #3
0
        public void CompareToWithSmallerFirstObject()
        {
            MockId first  = new MockId(10);
            object second = new MockId(11);

            Assert.IsTrue(first.CompareTo(second) < 0);
        }
コード例 #4
0
        public void CompareToWithNullObject()
        {
            MockId first  = new MockId(10);
            object second = null;

            Assert.AreEqual(1, first.CompareTo(second));
        }