public async Task Setup() { _model = new List <Product>() { new Product { Price = 1 }, new Product { Price = 4 }, new Product { Price = 2 }, new Product { Price = 3 } }; _productsRepository = new Mock <IProductsRepository>(); _productsRepository.Setup(r => r.GetProducts()).ReturnsAsync(_model); var handler = new GetSortRequestHandler(_productsRepository.Object, null); _sortResponse = await handler.Handle(new GetSortRequest { SortOption = "High" }, CancellationToken.None); }
public async Task Setup() { _model = new List <Product>() { new Product { Name = "Orange" }, new Product { Name = "Apple" }, new Product { Name = "Banana" }, new Product { Name = "Zucchini" } }; _productsRepository = new Mock <IProductsRepository>(); _productsRepository.Setup(r => r.GetProducts()).ReturnsAsync(_model); var handler = new GetSortRequestHandler(_productsRepository.Object, null); _sortResponse = await handler.Handle(new GetSortRequest { SortOption = "Descending" }, CancellationToken.None); }
public async Task Setup() { _model = new List <ShopperHistory> { new ShopperHistory { CustomerId = 1, Products = new List <Product>() { new Product { Name = "Item1", Quantity = 1, Price = 1 }, new Product { Name = "Item2", Quantity = 1, Price = 2 } } }, new ShopperHistory { CustomerId = 2, Products = new List <Product>() { new Product { Name = "Item3", Quantity = 1, Price = 3 }, new Product { Name = "Item4", Quantity = 1, Price = 4 } } }, new ShopperHistory { CustomerId = 3, Products = new List <Product>() { new Product { Name = "Item3", Quantity = 2, Price = 3 } } }, new ShopperHistory { CustomerId = 1, Products = new List <Product>() { new Product { Name = "Item2", Quantity = 1, Price = 2 } } } }; _shopperHistoryRepository = new Mock <IShopperHistoryRepository>(); _shopperHistoryRepository.Setup(r => r.GetCustomerHistory()).ReturnsAsync(_model); var handler = new GetSortRequestHandler(null, _shopperHistoryRepository.Object); _sortResponse = await handler.Handle(new GetSortRequest { SortOption = "Recommended" }, CancellationToken.None); }