public void ReturnsStoreWithId10_GivenStoreByIdSpec() { var spec = new StoreByIdSpec(10); var store = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).FirstOrDefault(); store.Id.Should().Be(10); }
public void ReturnsOrderStoresByNameDescThenByIdForCompanyWithId2_GivenStoresByCompanyOrderedDescByNameThenByIdSpec() { var spec = new StoresByCompanyOrderedDescByNameThenByIdSpec(2); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.First().Id.Should().Be(99); stores.Last().Id.Should().Be(98); }
public void ReturnsOrderStoresByNameDescForCompanyWithId2_GivenStoresByCompanyOrderedDescByNameSpec() { var spec = new StoresByCompanyOrderedDescByNameSpec(2); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.First().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_FOR_COMPANY2_FIRST_ID); stores.Last().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_FOR_COMPANY2_LAST_ID); }
public void ReturnsOrderedStores_GivenStoresOrderedDescendingByNameSpec() { var spec = new StoresOrderedDescendingByNameSpec(); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.First().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_FIRST_ID); stores.Last().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_LAST_ID); }
public void ReturnsStoreWithIdFrom15To30_GivenStoresByIdListSpec() { var ids = Enumerable.Range(15, 16); var spec = new StoresByIdListSpec(ids); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.Count.Should().Be(16); stores.OrderBy(x => x.Id).First().Id.Should().Be(15); stores.OrderBy(x => x.Id).Last().Id.Should().Be(30); }
public void ReturnsSecondPageOfStoresForCompanyWithId2_GivenStoresByCompanyPaginatedOrderedDescByNameSpec() { int take = 10; // pagesize 10 int skip = (2 - 1) * 10; // page 2 var spec = new StoresByCompanyPaginatedOrderedDescByNameSpec(2, skip, take); var stores = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); stores.Count.Should().Be(take); stores.First().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_FOR_COMPANY2_PAGE2_FIRST_ID); stores.Last().Id.Should().Be(StoreSeed.ORDERED_BY_NAME_DESC_FOR_COMPANY2_PAGE2_LAST_ID); }
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); }
public void ReturnsSecondPageOfStoreNames_GivenStoreNamesPaginatedSpec() { int take = 10; // pagesize 10 int skip = (2 - 1) * 10; // page 2 var spec = new StoreNamesPaginatedSpec(skip, take); var storeNames = evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList(); storeNames.Count.Should().Be(take); storeNames.First().Should().Be("Store 11"); storeNames.Last().Should().Be("Store 20"); }
public void ThrowsDuplicateOrderChainException_GivenSpecWithMultipleOrderChains() { var spec = new StoresOrderedTwoChainsSpec(); Assert.Throws <DuplicateOrderChainException>(() => evaluator.GetQuery(StoreSeed.AsQueryable(), spec).ToList()); }