Exemple #1
0
        public void QueryTest(
            [Values(10, 10, 10)] int pages,
            [Values(null, 10, 12)] int?requestedPage,
            [Values(1, 10, 10)] int expectedPage)
        {
            var tag = "Tag1";
            var expectedPageSize      = TestedController.DefaultPageSize;
            var expectedRequestedPage = requestedPage == null ? 1 : requestedPage.Value;

            var postListPage = new PagedList <Post>(new Post[] { }, expectedPage, expectedPageSize, pages);

            _postRepositoryMock.Expect(r => r.ListPublishedByTag(expectedRequestedPage, expectedPageSize, tag)).Return(postListPage);


            var result = TestedController.Query(requestedPage, tag);


            VerifyViewResult(result, "List", typeof(PagedList <Post>), postListPage);
        }