public async Task ReturnsSecondPageOfStores_GivenStoresPaginatedSpec() { int take = 10; // pagesize 10 int skip = (2 - 1) * 10; // page 2 var spec = new StoresPaginatedSpec(skip, take); var stores = await storeRepository.ListAsync(spec); stores.Count.Should().Be(take); stores.OrderBy(x => x.Id).First().Id.Should().Be(11); stores.OrderBy(x => x.Id).Last().Id.Should().Be(20); }
public void ReturnsSecondPageOfStores_GivenStoresPaginatedSpec() { int take = 10; // pagesize 10 int skip = (2 - 1) * 10; // page 2 var spec = new StoresPaginatedSpec(skip, take); var stores = spec.Evaluate(StoreSeed.Get()); stores.Count().Should().Be(take); stores.OrderBy(x => x.Id).First().Id.Should().Be(11); stores.OrderBy(x => x.Id).Last().Id.Should().Be(20); }
public void ReturnsSecondPageOfStores_GivenStoresPaginatedSpec() { int take = 10; // pagesize 10 int skip = (2 - 1) * 10; // page 2 var spec = new StoresPaginatedSpec(skip, take); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.Count.Should().Be(take); stores.OrderBy(x => x.Id).First().Id.Should().Be(11); stores.OrderBy(x => x.Id).Last().Id.Should().Be(20); }