public void WhenCalledBuyItem_PaymentSuccessfulForAvailableItemsInStock_ReturnsItemCount()
        {
            _discountService.Setup(x => x.ApplyDiscount(It.IsAny <Int16>(), It.IsAny <double>())).Returns(It.IsAny <double>());
            _paymentGateWay.Setup(x => x.GetAsync(It.IsAny <string>())).Returns(Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)));
            _logger.Setup(x => x.write(It.IsAny <string>()));
            var result = _shoppingService.BuyItems(items);

            Assert.AreEqual(2, result);
        }
 public JsonResult Register(int customerId)
 {
     if (customerId.ToString() != null)
     {
         _paymentGatewayClient = new PaymentGatewayClient(new HttpClient());
         List <string> items = new List <string>()
         {
             "Breads", "Milk", "Biscuits", "Dryfruits"
         };
         ShoppingService shoppingService = new ShoppingService(customerId, _stockService, _discountService, _paymentGatewayClient, _logger);
         var             count           = shoppingService.BuyItems(items);
         var             result          = count > 0 ? $"Shopping done for {count} products" : $"Shopping done for { count} product";
         return(Json(result));
     }
     return(Json("Invalid Customer Id"));
 }