Example #1
0
        public async Task LastPage_CanReturn_FewerThan_PageSize()
        {
            var db = GetTestDb("last_page");

            var query = new blog.Data.GetPostsQuery(db);

            var results = await query.ExecuteAsync(page : 4, pageSize : 3);

            Assert.Collection <Post>(results,
                                     x => Assert.Equal("Ten", x.Title)
                                     );
        }
Example #2
0
        public async Task FirstPage_ShouldReturn_FirstPage()
        {
            var db = GetTestDb("first_page");

            var query = new blog.Data.GetPostsQuery(db);

            var results = await query.ExecuteAsync(page : 1, pageSize : 5);

            Assert.Collection <Post>(results,
                                     x => Assert.Equal("One", x.Title),
                                     x => Assert.Equal("Two", x.Title),
                                     x => Assert.Equal("Three", x.Title),
                                     x => Assert.Equal("Four", x.Title),
                                     x => Assert.Equal("Five", x.Title)
                                     );
        }