public void IsNextPageAvailable_WhenGivenZeroValuesAsArguments_ThenConditionReturnsFalse() { var expected = false; var actual = _pagionator.IsNextPageAvailable(0, 0); Assert.That(expected, Is.EqualTo(actual)); }
public async Task <IActionResult> GetAll(int page = 1, string search = null) { if (!_authentication.IsAuthenticated(User)) { return(RedirectToAction("SignIn", "Authentication")); } IEnumerable <Employee> employees = await _repository.BrowseAsync(search); int pageCount = _paginator.GetPageCount(employees.Count()); int previousPage = _paginator.GetPreviousPageIndex(page); int nextPage = _paginator.GetNextPageIndex(page); ViewBag.PreviousPage = previousPage; ViewBag.NextPage = nextPage; ViewBag.HasPreviousPage = _paginator.IsPreviousPageAvailable(previousPage); ViewBag.HasNextPage = _paginator.IsNextPageAvailable(nextPage, pageCount); employees = employees .Skip(_paginator.PageSize * (page - 1)) .Take(_paginator.PageSize) .ToList(); return(View("Browse", employees)); }