public void OrdersService_GetTop5ProductSold_should_throw_exception_when_argument_is_null()
        {
            //Arrange
            var orderResult = new OrdersResultFaker().SeedEntities(1).First();

            _genericRestClientMock.Setup(_ => _.GetAsync <OrdersResult>(It.IsAny <string>()))
            .ReturnsAsync(() => orderResult);

            //Act & Assert
            Assert.ThrowsAsync <ArgumentNullException>(async() =>
                                                       await _sut.UpdateProductStockTo25(null));
        }
        public void OrdersService_GetTop5ProductSold_should_throw_exception_when_there_is_no_product_details()
        {
            //Arrange
            var orderResult = new OrdersResultFaker().SeedEntities(1).First();

            _genericRestClientMock.Setup(_ => _.GetAsync <OrdersResult>(It.IsAny <string>()))
            .ReturnsAsync(() => orderResult);

            //Act & Assert
            Assert.ThrowsAsync <ApplicationException>(async() =>
                                                      await _sut.GetTop5ProductSold());
        }
        public async Task OrdersService_GetAllOrdersInStatusInProgress_should_return_OrderResultAsync()
        {
            //Arrange
            var orderResult = new OrdersResultFaker().SeedEntities(1).First();

            _genericRestClientMock.Setup(_ => _.GetAsync <OrdersResult>(It.IsAny <string>()))
            .ReturnsAsync(() => orderResult);

            //Act
            var result = await _sut.GetAllOrdersInStatusInProgress();

            //Assert
            Assert.IsInstanceOf <OrdersResult>(result);
            Assert.IsTrue(result.Content.Any());
        }
        public async Task OrdersService_GetTop5ProductSold_should_return_OrderResultAsync()
        {
            //Arrange
            var orderResult = new OrdersResultFaker().SeedEntities(1).First();

            _genericRestClientMock.Setup(_ => _.GetAsync <OrdersResult>(It.IsAny <string>()))
            .ReturnsAsync(() => orderResult);
            var productsResult = new ProductsResultFaker().SeedEntities(1).First();

            _genericRestClientMock.Setup(_ => _.GetAsync <ProductsResult>(It.IsAny <string>()))
            .ReturnsAsync(() => productsResult);

            //Act
            var result = await _sut.GetTop5ProductSold();

            //Assert
            Assert.IsInstanceOf <ICollection <ProductVm> >(result);
            Assert.That(result.Count, Is.LessThanOrEqualTo(5));
            Assert.That(result.Select(_ => _.Quantity).ToList(), Is.Ordered.Descending);
        }