Exemplo n.º 1
0
        public void CompareToWithUnequalObjectTypes()
        {
            IComparable first  = new CommandId("name");
            var         second = new object();

            Assert.Throws <ArgumentException>(() => first.CompareTo(second));
        }
Exemplo n.º 2
0
        public void CompareToOperatorWithEqualObjects()
        {
            IComparable first  = new CommandId("name");
            object      second = new CommandId("name");

            Assert.AreEqual(0, first.CompareTo(second));
        }
Exemplo n.º 3
0
        public void CompareToWithLargerFirstObject()
        {
            IComparable first  = new CommandId("b");
            object      second = new CommandId("a");

            Assert.IsTrue(first.CompareTo(second) > 0);
        }
Exemplo n.º 4
0
        public void CompareToWithNullObject()
        {
            IComparable first  = new CommandId("name");
            object      second = null;

            Assert.AreEqual(1, first.CompareTo(second));
        }
Exemplo n.º 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);
        }