public async Task Should_ReturnSeparateProducts_When_OrderContainsMoreThanOneLine(string no1, string no2, string no3, string no4)
        {
            dataSourceMock.GetInProgressOrdersAsyncMock(OrderFactory.CreateOrders(
                                                            OrderFactory.CreateOrdersWithLines(no1),
                                                            OrderFactory.CreateOrdersWithLines(no2, no3),
                                                            OrderFactory.CreateOrdersWithLines(no4)
                                                            ));
            var topSoldProductService = new TopSoldProductService(dataSourceMock.Object);

            var products = await topSoldProductService.GetOrderTopSoldProducts();

            Assert.Equal(4, products.Count());
        }
        public async Task Should_ReturnUniqueMerchantNumbers(string no1, string no2, string no3, string no4)
        {
            dataSourceMock.GetInProgressOrdersAsyncMock(OrderFactory.CreateOrders(
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no1, 3)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no2, 3), LineFactory.CreateLine(no3, 4)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no1, 10)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no4, 5), LineFactory.CreateLine(no3, 8)))
                                                        );
            var topSoldProductService = new TopSoldProductService(dataSourceMock.Object);

            var products = await topSoldProductService.GetOrderTopSoldProducts();

            Assert.Equal(products.Select(x => x.MerchantProductNo), products.Select(x => x.MerchantProductNo).Distinct());
        }
        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_SortProductsByTotalQuantity(string no1, string no2, string no3, string no4)
        {
            dataSourceMock.GetInProgressOrdersAsyncMock(OrderFactory.CreateOrders(
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no1, 3)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no2, 1), LineFactory.CreateLine(no3, 4)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no4, 10))
                                                            ));
            var topSoldProductService = new TopSoldProductService(dataSourceMock.Object);

            var products = await topSoldProductService.GetOrderTopSoldProducts();

            Assert.Collection(products,
                              x => Assert.Equal(no4, x.MerchantProductNo),
                              x => Assert.Equal(no3, x.MerchantProductNo),
                              x => Assert.Equal(no1, x.MerchantProductNo),
                              x => Assert.Equal(no2, x.MerchantProductNo)
                              );
        }
        public async Task Should_ReturnProductByMerchantProductNo_When_FifthAndSixthHaveSameQuantity(string no1, string no2, string no3, string no4, string no5, string no6)
        {
            dataSourceMock.GetInProgressOrdersAsyncMock(OrderFactory.CreateOrders(
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no1, 3)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no2, 3), LineFactory.CreateLine(no3, 4)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no4, 10)),
                                                            OrderFactory.CreateOrdersWithLines(LineFactory.CreateLine(no5, 5), LineFactory.CreateLine(no6, 8)))
                                                        );
            var topSoldProductService = new TopSoldProductService(dataSourceMock.Object);

            var products = await topSoldProductService.GetOrderTopSoldProducts();

            Assert.Collection(products,
                              x => Assert.Equal(no4, x.MerchantProductNo),
                              x => Assert.Equal(no6, x.MerchantProductNo),
                              x => Assert.Equal(no5, x.MerchantProductNo),
                              x => Assert.Equal(no3, x.MerchantProductNo),
                              x => Assert.Equal(no1, x.MerchantProductNo)
                              );
        }