public async Task Should_ReturnOnlyFiveProducts_When_DataSourceContainsMoreThanFive(string no1, string no2, string no3, string no4, string no5, string no6) { dataSourceMock.GetInProgressOrdersAsyncMock(OrderFactory.CreateOrders( OrderFactory.CreateOrdersWithLines(no1), OrderFactory.CreateOrdersWithLines(no2, no3), OrderFactory.CreateOrdersWithLines(no4), OrderFactory.CreateOrdersWithLines(no5), OrderFactory.CreateOrdersWithLines(no6) )); dataSourceMock.GetProductsAsyncMock(ProductFactory.CreateProducts(no1, no2, no3, no4, no5, no6)); var topSoldProductService = new TopSoldProductService(dataSourceMock.Object); var products = await topSoldProductService.GetOrderTopSoldProducts(); Assert.Equal(5, products.Count()); }
public async Task Should_FillProductsNames(string no1, string no2, string no3, string no4, string no5, string no6) { dataSourceMock.GetProductsAsyncMock(ProductFactory.CreateProducts(no1, no2, no3, no4, no5, no6)); topSoldProductServiceMock.GetOrderTopSoldProducts(LineFactory.CreateLines( LineFactory.CreateLine(no1), LineFactory.CreateLine(no2), LineFactory.CreateLine(no3), LineFactory.CreateLine(no4), LineFactory.CreateLine(no5) )); var handler = new GetTopSoldProductsQueryHandler(dataSourceMock.Object, topSoldProductServiceMock.Object); var products = await handler.Handle(new GetTopSoldProductsQuery(), CancellationToken.None); Assert.All(products, x => Assert.NotNull(x.Name)); }