Exemple #1
0
        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;
        }
Exemple #2
0
 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());
 }