Пример #1
0
        public void CompareToWithUnequalObjectTypes()
        {
            IComparable first  = new CommandId("name");
            var         second = new object();

            Assert.Throws <ArgumentException>(() => first.CompareTo(second));
        }
Пример #2
0
        public void CompareToOperatorWithEqualObjects()
        {
            IComparable first  = new CommandId("name");
            object      second = new CommandId("name");

            Assert.AreEqual(0, first.CompareTo(second));
        }
Пример #3
0
        public void CompareToWithLargerFirstObject()
        {
            IComparable first  = new CommandId("b");
            object      second = new CommandId("a");

            Assert.IsTrue(first.CompareTo(second) > 0);
        }
Пример #4
0
        public void CompareToWithNullObject()
        {
            IComparable first  = new CommandId("name");
            object      second = null;

            Assert.AreEqual(1, first.CompareTo(second));
        }
Пример #5
0
        public void CompareToWithSmallerFirstObject()
        {
            IComparable first  = new CommandId("a");
            object      second = new CommandId("b");

            Assert.IsTrue(string.Compare("a", "b", StringComparison.Ordinal) < 0);
            Assert.IsTrue(first.CompareTo(second) < 0);
        }