コード例 #1
0
        public void OrderBy_CanBuildExpression()
        {
            var mapping = new TypeMapping<IPerson, Person>();
            var expression = mapping.OrderBy("p => p.Birthdate").Compile();

            var persons = new List<IPerson>
            {
                new Person{ Id = 1, Birthdate = DateTime.Parse("1987-03-02") },
                new Person{ Id = 2, Birthdate = DateTime.Parse("1987-03-01") },
            };

            var orderedPersons = persons.OrderBy(expression).ToList();

            Assert.AreEqual(2, orderedPersons[0].Id);
        }