public void ThenByDescendingNullKey()
        {
            Country        england, france, china, india, unknown;
            Data <Country> data = Data
                                  (
                england = new Country()
            {
                Name = "England", Continent = "Europe"
            },
                france = new Country()
            {
                Name = "France", Continent = "Europe"
            },
                china = new Country()
            {
                Name = "China", Continent = "Asia"
            },
                india = new Country()
            {
                Name = "India", Continent = "Asia"
            },
                unknown = new Country()
            {
                Name = "Unknown", Continent = null
            }
                                  );

            IOrderedEnumerable <Country> orderedData = data.OrderBy(x => true).ThenByDescending(x => x.Continent);

            orderedData.AssertSame(england, france, china, india, unknown);
        }
示例#2
0
        public void ThenByWithComparerNullKey()
        {
            Country        england, france, china, india, unknown;
            Data <Country> data = Data
                                  (
                england = new Country()
            {
                Name = "England", Continent = "Europe"
            },
                france = new Country()
            {
                Name = "France", Continent = "Europe"
            },
                china = new Country()
            {
                Name = "China", Continent = "Asia"
            },
                india = new Country()
            {
                Name = "India", Continent = "Asia"
            },
                unknown = new Country()
            {
                Name = "Unknown", Continent = null
            }
                                  );

            IOrderedEnumerable <Country> orderedData = data.OrderBy(x => true).ThenBy(x => x.Continent, Comparer <string> .Default);

            orderedData.AssertSame(unknown, china, india, england, france);
        }