public List <DishResponse> Get(string _choices)
        {
            List <DishResponse> response = new List <DishResponse>();


            if (_choices != null)
            {
                Mealtime     mealtime;
                DishResponse dishResponse = new DishResponse();
                dishResponse.Input = _choices;

                //first comma
                int fc = _choices.IndexOf(",");

                try{
                    //Find Mealtime inside input
                    mealtime = _requestDishes.ValidateMealtime(_choices, fc);
                    //Find Meals, ordenate list and create a string for output
                    dishResponse.Output = _requestDishes.ValidateOutput(_choices, fc, mealtime);
                }
                catch
                {
                    response.Add(new DishResponse("error", dishResponse.Input));
                    return(response);
                }

                response.Add(dishResponse);
            }



            return(response);
        }
Ejemplo n.º 2
0
 public void MustEnterCommaDelimitedListOfDishs()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => _irequestDishes.ValidateOutput("ThereIsNotCommaHere", 20, Mealtime.morning));
 }