public void MoveNextPage_ByDefault_DoesNotMoveToNextPage() { // Arrange var paginator = new SortingPaginator <Person>(pageNumber: 1, pageSize: 5); // Act var result = paginator.MoveNextPage(); // Assert Assert.IsFalse(result); Assert.AreNotEqual(2, paginator.PageNumber); }
public void MoveNextPage_AfterPaginating_MovesToNextPage() { // Arrange var paginator = new SortingPaginator <Person>(pageNumber: 1, pageSize: 5); paginator.Paginate(People); // Act var result = paginator.MoveNextPage(); // Assert Assert.IsTrue(result); Assert.AreEqual(2, paginator.PageNumber); }
protected async override Task OnApplicationStartedAsync(CancellationToken cancellationToken) { var uow = ServiceProvider.GetRequiredService <IUnitOfWork>(); if (!uow.IsTransactional) { await uow.BeginTransactionAsync(cancellationToken); } new DataSeeder().Seed(uow.People()); await uow.CompleteAsync(cancellationToken).ConfigureAwait(true); var person = uow.People().Find(new FilterByName { FamilyName = "Welsh" }).SingleOrDefault(); var paginator = new SortingPaginator <Person>().StartingAt(1).WithPageSizeOf(2).SortedBy("Contact.HomeAddress.State", SortDirection.Descending); do { var people = uow.People().All(paginator); } while (paginator.MoveNextPage()); }