示例#1
0
        public void CompareTo_1()
        {
            var brownde01 = new PlayerBlobObject
            {
                ID   = "brownde01",
                Name = "Dee Brown"
            };

            var brownde02 = new PlayerBlobObject
            {
                ID   = "brownde02",
                Name = "Devin Brown"
            };

            var brownde03 = new PlayerBlobObject
            {
                ID   = "brownde03",
                Name = "Dee Brown"
            };

            Assert.IsTrue(brownde01.CompareTo(brownde02) < 0);
            Assert.IsTrue(brownde02.CompareTo(brownde01) > 0);
            Assert.IsTrue(brownde01.CompareTo(brownde01) == 0);
            Assert.IsTrue(brownde01.CompareTo(brownde03) < 0);
            Assert.IsTrue(brownde02.CompareTo(brownde03) > 0);

            Assert.IsTrue(new[] { brownde01, brownde03, brownde02 }.SequenceEqual(
                              new[] { brownde01, brownde02, brownde03 }.OrderBy(p => p)));
        }
示例#2
0
        public void CompareTo_2()
        {
            var player1 = new PlayerBlobObject
            {
                ID   = "aa01",
                Name = "A A A"
            };

            var player2 = new PlayerBlobObject
            {
                ID   = "aab01",
                Name = "Ab A A"
            };

            Assert.IsTrue(player1.CompareTo(player2) < 0);
        }