コード例 #1
0
        public void OrderExpresso_WithMilkAndSugarAndChocolate()
        {
            AbstractAcuCafeFactory AcuCafeFactory = AcuCafeFactoryProducer.GetAcuCafeFactory(true);
            IDrink drinkFullOrder = AcuCafeAddInsRules.ProcessCoofeeAddIns(AcuCafeFactory.GetDrink(AcuCafeEnum.EnumDrinks.EXPRESSO), true, true, true);

            Assert.AreEqual("Expresso, Chocolate, Sugar, Milk", drinkFullOrder.Prepare());
            Assert.AreEqual(1.8 + 0.5 + 0.5 + 0.5, drinkFullOrder.Cost());
        }
コード例 #2
0
        public void OrderIceTea_WithMilk()
        {
            AbstractAcuCafeFactory AcuCafeFactory = AcuCafeFactoryProducer.GetAcuCafeFactory(false);
            IDrink drinkFullOrder = AcuCafeAddInsRules.ProcessTeaAddIns(AcuCafeFactory.GetDrink(AcuCafeEnum.EnumDrinks.ICETEA), true, false);

            Assert.AreEqual("IceTea", drinkFullOrder.Prepare());
            Assert.AreEqual(1.8, drinkFullOrder.Cost());
        }
コード例 #3
0
        public void OrderTea_WithSugarAndMilk()
        {
            AbstractAcuCafeFactory AcuCafeFactory = AcuCafeFactoryProducer.GetAcuCafeFactory(false);
            IDrink drinkFullOrder = AcuCafeAddInsRules.ProcessCoofeeAddIns(AcuCafeFactory.GetDrink(AcuCafeEnum.EnumDrinks.TEA), true, true, false);

            Assert.AreEqual("Tea, Sugar, Milk", drinkFullOrder.Prepare());
            Assert.AreEqual(1.5 + 0.5 + 0.5, drinkFullOrder.Cost());
        }
コード例 #4
0
        public void OrderLungo_WithMilkAndChocolate()
        {
            AbstractAcuCafeFactory AcuCafeFactory = AcuCafeFactoryProducer.GetAcuCafeFactory(true);
            IDrink drinkFullOrder = AcuCafeAddInsRules.ProcessCoofeeAddIns(AcuCafeFactory.GetDrink(AcuCafeEnum.EnumDrinks.LUNGO), true, false, true);

            Assert.AreEqual("Lungo, Chocolate, Milk", drinkFullOrder.Prepare());
            Assert.AreEqual(2 + 0.5 + 0.5, drinkFullOrder.Cost());
        }
コード例 #5
0
        public void OrderRistretto_WithSugarAndChocolate()
        {
            AbstractAcuCafeFactory AcuCafeFactory = AcuCafeFactoryProducer.GetAcuCafeFactory(true);
            IDrink drinkFullOrder = AcuCafeAddInsRules.ProcessCoofeeAddIns(AcuCafeFactory.GetDrink(AcuCafeEnum.EnumDrinks.RISTRETTO), false, true, true);

            Assert.AreEqual("Ristretto, Chocolate, Sugar", drinkFullOrder.Prepare());
            Assert.AreEqual(1.5 + 0.5 + 0.5, drinkFullOrder.Cost());
        }
コード例 #6
0
 /// <summary>
 /// process the selected addIns
 /// </summary>
 /// <param name="isCoffee"></param>
 private void ProcessAddIns(bool isCoffee)
 {
     if (isCoffee)
     {
         drinkOrder = AcuCafeAddInsRules.ProcessCoofeeAddIns(drinkOrder, ckbMilk.Checked, ckbSugar.Checked, ckbChocolate.Checked);
     }
     else
     {
         drinkOrder = AcuCafeAddInsRules.ProcessTeaAddIns(drinkOrder, ckbMilk.Checked, ckbSugar.Checked);
     }
 }