예제 #1
0
        public void QueryWithOrderByThenByDescending()
        {
            var users    = Database.Query <User>().Include(x => x.House).OrderBy(x => x.House.HouseId).ThenByDescending(x => x.UserId).ToList();
            var inmemory = InMemoryUsers.OrderBy(x => x.House != null ? x.House.HouseId : -1).ThenByDescending(x => x.UserId).ToList();

            Assert.AreEqual(15, users.Count);
            for (int i = 0; i < users.Count; i++)
            {
                AssertUserValues(inmemory[i], users[i]);
            }
        }
예제 #2
0
        public void QueryWithLimitWithOffset()
        {
            var users    = Database.Query <User>().OrderBy(x => x.UserId).Limit(5, 5).ToList();
            var inmemory = InMemoryUsers.OrderBy(x => x.UserId).Skip(5).Take(5).ToList();

            Assert.AreEqual(5, users.Count);
            for (int i = 0; i < users.Count; i++)
            {
                AssertUserValues(inmemory[i], users[i]);
            }
        }
예제 #3
0
        public void QueryWithOrderBy()
        {
            var users    = Database.Query <User>().OrderBy(x => x.DateOfBirth).ToList();
            var inmemory = InMemoryUsers.OrderBy(x => x.DateOfBirth).ToList();

            Assert.AreEqual(15, users.Count);
            for (int i = 0; i < users.Count; i++)
            {
                AssertUserValues(inmemory[i], users[i]);
            }
        }