コード例 #1
0
        public void PlaceOrder_GivenValidOrder_ExpectTicket()
        {
            var stand    = standControl.GetRandom();
            var products = new List <string>()
            {
                stand.Meals.First().Name,
                stand.Drinks.First().Name
            };

            var ticket = standControl.PlaceOrder(stand.Guid, products);

            Assert.NotEmpty(ticket);
        }
コード例 #2
0
        public ActionResult <string> OrderDinner(Guid guid, [FromBody] List <string> products)
        {
            try
            {
                var stand = standControl.GetStand(guid);

                var orderTicket = standControl.PlaceOrder(stand.Guid, products);

                if (string.IsNullOrEmpty(orderTicket))
                {
                    return(BadRequest());
                }

                return(Ok(orderTicket));
            }
            catch (InvalidOperationException)
            {
                return(NotFound());
            }
            catch (ArgumentNullException)
            {
                return(NotFound());
            }
        }