public void MakeOrderByTimeOfDayTest1() { DinerOrderBuilding builder = new DinerOrderBuilding(); Order testOrder = builder.MakeOrderByTimeOfDay("night"); OrderFactory nightOrderFactory = new NightOrderFactory(); NightOrder nightOrder = new NightOrder(nightOrderFactory, 1, 99, 1, 1); Assert.AreEqual(testOrder.GetType(), nightOrder.GetType()); }
public void MakeOrderByTimeOfDayTest() { DinerOrderBuilding builder = new DinerOrderBuilding(); Order testOrder = builder.MakeOrderByTimeOfDay("morning"); OrderFactory morningOrderFactory = new MorningOrderFactory(); MorningOrder morningOrder = new MorningOrder(morningOrderFactory, 1, 1, 99, 1); Assert.AreEqual(testOrder.GetType(), morningOrder.GetType()); }
static void Main(string[] args) { if(args.Length == 1) { try { string input = args[0]; DinerOrderBuilding newDiner = new DinerOrderBuilding(); string timeOfDay = input.Substring(0, input.IndexOf(',')); string orderString = input.Substring(input.IndexOf(',') + 1); if (timeOfDay.ToLower() == "morning" || timeOfDay.ToLower() == "night") { Order order = newDiner.PlaceTheOrder(timeOfDay, orderString); Console.WriteLine(order.ToString()); } else Console.WriteLine("Invalid time of day"); } catch (Exception ex) { Console.WriteLine("Bad input"); } } else if (args.Length > 1) { Console.WriteLine("Invaild number of parameter. Please provide input with no spaces or no parameter at all"); } else { DinerOrderBuilding newDiner = new DinerOrderBuilding(); Order order = newDiner.PlaceTheOrder("morning", "1,2,3"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("morning", "2,1,3"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("morning", "1,2,3,4"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("morning", "1,2,3,3,3"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("night", "1,2,3,4"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("night", "1,2,2,4"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("night", "1,2,3,5"); Console.WriteLine(order.ToString()); order = newDiner.PlaceTheOrder("night", "1,1,2,3,5"); Console.WriteLine(order.ToString()); } }