public override Order MakeOrderByTimeOfDay(string timeOfDay) { Order currentOrder = null; if (timeOfDay.ToLower() == "morning") { OrderFactory morningOrderFactory = new MorningOrderFactory(); //Creating a morning order with the following limits //1 Entree //1 Side //Unlimited drinks //No deserts currentOrder = new MorningOrder(morningOrderFactory,1,1,99,0); } else if (timeOfDay.ToLower() == "night") { OrderFactory nightOrderFactory = new NightOrderFactory(); //Creating a night order with the following limits //1 Entree //Unlimited Sides //1 drink //1 deserts currentOrder = new NightOrder(nightOrderFactory,1,99,1,1); } return currentOrder; }
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()); }
public void AddSideTest() { OrderFactory orderFactory = new MorningOrderFactory(); Dish side = orderFactory.AddSide(); Assert.AreEqual(side.GetType(), new Toast().GetType()); }
public void AddInvalidDishTest() { OrderFactory orderFactory = new MorningOrderFactory(); Dish invalid = orderFactory.AddInvalidDish(); Assert.AreEqual(invalid.Name, "error"); }
public void AddEntreeTest() { OrderFactory orderFactory = new MorningOrderFactory(); Dish entree = orderFactory.AddEntree(); Assert.AreEqual(entree.GetType(), new Eggs().GetType()); }
public void AddDrinkTest() { OrderFactory orderFactory = new MorningOrderFactory(); Dish drink = orderFactory.AddDrink(); Assert.AreEqual(drink.GetType(), new Coffee().GetType()); }
public void AddDesertTest() { OrderFactory orderFactory = new MorningOrderFactory(); Dish desert = orderFactory.AddDesert(); Assert.AreEqual(desert.Name, "error"); }