public void CheckoutTest()
      {
          var mockRepository = new Mock <IRepository>();

          mockRepository.Setup(r => r.AddCustomerOrder(new Order(1, 1)));

          var controller = new ShoppingCartController(mockRepository.Object);

          // Act
          var result = controller.Checkout();

          // Assert false becasue cart is empty
          Assert.False(controller.ModelState.IsValid);
      }
        public static async Task CheckoutAsync(string name, long creditCardNumber, int cvc, string expiryDate, int zipCode, decimal price)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>
            {
                { "Name", name },
                { "CreditCardNumber", creditCardNumber.ToString() },
                { "CVC", cvc.ToString() },
                { "ExpiryDate", expiryDate },
                { "ZipCode", zipCode.ToString() },
                { "Price", price.ToString() }
            };
            FormUrlEncodedContent encodedContent = new FormUrlEncodedContent(parameters);

            using (HttpResponseMessage response = await ShoppingCartController.Checkout(encodedContent))
            {
                int    status = (int)response.StatusCode;
                string body   = await response.Content.ReadAsStringAsync();

                if (status == 200)
                {
                    return;
                }
                else if (status == 400)
                {
                    throw new ArgumentException(body);
                }
                else if (status == 401)
                {
                    throw new UnauthenticatedException();
                }
                else if (status == 500)
                {
                    throw new ServerException();
                }
                else
                {
                    throw new Exception("An uncaught error occurred.");
                }
            }
        }