示例#1
0
        public void Confirm_Order()
        {
            ValuesController controller = new ValuesController(_shoppingService);
            var productToAdd            = new Product()
            {
                ProductCode = "ABC123", Quantity = 2, UnitPrice = 1.99M
            };
            IHttpActionResult result = controller.AddToCart("Tony Stark", productToAdd);

            productToAdd = new Product()
            {
                ProductCode = "QQ22", Quantity = 1, UnitPrice = 15.99M
            };
            result = controller.AddToCart("Tony Stark", productToAdd);

            IHttpActionResult orderResult = controller.ConfirmOrder("Tony Stark");

            Assert.IsInstanceOfType(orderResult, typeof(OkResult));
        }
示例#2
0
        public void Add_Product_To_ShoppingCart()
        {
            ValuesController controller = new ValuesController(_shoppingService);
            var incomingRequest         = new Product()
            {
                ProductCode = "ABC123", Quantity = 2, UnitPrice = 1.99M
            };

            IHttpActionResult result = controller.AddToCart("Tony Stark", incomingRequest);

            Assert.IsInstanceOfType(result, typeof(OkResult));
        }