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);
        }
示例#2
0
 public void TheyShouldChoiceMorningOrNigth()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => _irequestDishes.ValidateMealtime("evening", 8));
 }