public async Task GetBasketsWithPageSize() { // arrange var basket1 = new BasketOfItems(1); basket1.AddUpdateOrRemoveItem(1, 3); await _sut.CreateBasketAsync(basket1); var basket2 = new BasketOfItems(1); basket2.AddUpdateOrRemoveItem(2, 3); await _sut.CreateBasketAsync(basket2); var basket3 = new BasketOfItems(1); basket3.AddUpdateOrRemoveItem(3, 3); await _sut.CreateBasketAsync(basket3); // act var actual = await _sut.GetBaskets(0, 2); // assert Assert.That(actual.Count(), Is.EqualTo(2)); var basketIds = actual.Select(x => x.Id).ToArray(); Assert.That(basketIds, Does.Contain(basket1.Id)); Assert.That(basketIds, Does.Contain(basket2.Id)); }
public IEnumerable <Basket> GetBaskets(int?Domain = null) { return(Domain == null?basketRepository.GetBaskets() : basketRepository.GetBaskets().Where(x => x.Domain == Domain)); }