static void Main(string[] args) { string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appmenu.json"); dishLookup dishLookUp = new dishLookup(filePath); while (true) { Console.WriteLine("Enter \"x\" to end the program"); Console.WriteLine("Type your order"); string line = Console.ReadLine(); if (line == "x") { return; } string[] inputs = line.Replace(" ", "").Split(','); string time = inputs[0]; List<int> dishNumbers = new List<int>(); int value; for (int i = 1; i < inputs.Length; i++) { if (int.TryParse(inputs[i], out value)) dishNumbers.Add(value); else { Console.WriteLine("Invalid dish number. Please try again"); continue; } } try { dishInterface lookup = dishLookUp.Service(time); string result = lookup.getDishes(time, dishNumbers); Console.WriteLine(result); } catch (timeExc exception) { Console.WriteLine(exception.Message); } catch (Exception exception) { Console.WriteLine(exception.Message); return; } } }
public morningUnitTest() { string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appmenu.json"); this.dishLookUp = new dishLookup(filePath); }