Exemple #1
0
        public void CurrentPage_Returns_ExpectedValue_When_CurrentPage_IsGreater_Than_TotalPages(int totalItems,
                                                                                                 int pageSize, int currentPage, int expectedCurrentPage)
        {
            IPagingService pagingService = new AlgorithmLibrary.PagingService.PagingService(totalItems, pageSize,
                                                                                            currentPage);

            pagingService.CurrentPage.Should().Be(expectedCurrentPage);
        }
Exemple #2
0
        public void TestPlaceHolder()
        {
            // IPagingService pagingService = new AlgorithmLibrary.PagingService.PagingService(150, 15, 7, 5);
            //
            // pagingService.TotalItems.Should().Be(150);
            // pagingService.PageSize.Should().Be(15);
            // pagingService.CurrentPage.Should().Be(7);
            // pagingService.StartPage.Should().Be(5);
            // pagingService.EndPage.Should().Be(9);
            // pagingService.ItemStartIndex.Should().Be(90);
            // pagingService.ItemEndIndex.Should().Be(104);
            // pagingService.Pages.Should().BeEquivalentTo(new[] {5, 6, 7, 8, 9});

            IPagingService pagingService = new AlgorithmLibrary.PagingService.PagingService(100, 10, 9, 5);

            pagingService.TotalItems.Should().Be(100);
            pagingService.PageSize.Should().Be(10);
            pagingService.CurrentPage.Should().Be(9);
            // pagingService.StartPage.Should().Be(3);
            // pagingService.EndPage.Should().Be(7);
            // pagingService.ItemStartIndex.Should().Be(40);
            // pagingService.ItemEndIndex.Should().Be(49);
            // pagingService.Pages.Should().BeEquivalentTo(new[] {5, 6, 7, 8, 9});
        }
Exemple #3
0
        public void TotalPages_Returns_ExpectedResult(int totalItems, int pageSize, int expectedTotalPages)
        {
            IPagingService pagingService = new AlgorithmLibrary.PagingService.PagingService(totalItems, pageSize);

            pagingService.TotalPages.Should().Be(expectedTotalPages);
        }
Exemple #4
0
        public void PageSize_Returns_ExpectedResult(int pageSize, int expectedPageSize)
        {
            IPagingService pagingService = new AlgorithmLibrary.PagingService.PagingService(100, pageSize);

            pagingService.PageSize.Should().Be(expectedPageSize);
        }