Exemplo n.º 1
0
 public ChocolateAdapter(IDrink drink) : base(drink)
 {
     chocolate = new HotChocolate();
     Price     = chocolate.Cost();
     Name      = chocolate.GetNameOfDrink();
     //deluxe is just as expensive as regular?
 }
        public ChocolateDeluxe()
        {
            CompatibleToppings = new List <string>();

            _chocolate = new HotChocolate();
            _chocolate.MakeDeluxe();
        }
Exemplo n.º 3
0
 public HotChocolateDeluxeWrapper(HotChocolate choco)
 {
     _hotChocolate = choco;
     _hotChocolate.MakeDeluxe();
     Name      = choco.GetNameOfDrink();
     BasePrice = 1.20;
 }
Exemplo n.º 4
0
 public Chocolate(bool makeDeluxe = false)
 {
     _choco = new HotChocolate();
     if (makeDeluxe)
     {
         _choco.MakeDeluxe();
     }
 }
Exemplo n.º 5
0
        public HotChocolateDecorator(IDrink drink, bool deluxe) : base(drink)
        {
            Drink          = drink;
            chocolatedrink = new HotChocolate();

            if (deluxe)
            {
                chocolatedrink.MakeDeluxe();
            }
        }
Exemplo n.º 6
0
        public HotChocolateAdapter(bool isDeluxe)
        {
            _adaptee = new HotChocolate();

            if (isDeluxe)
            {
                _adaptee.MakeDeluxe();
            }

            Name = _adaptee.GetNameOfDrink();
        }
Exemplo n.º 7
0
        public void WrapperTests()
        {
            var coffee      = new Coffee();
            var sugarCoffee = new SugarDecorator(coffee);

            Assert.AreEqual("Coffee, Sugar", sugarCoffee.Ingredients);

            var hotChocolate     = new HotChocolate();
            var milkHotChocolate = new MilkDecorator(hotChocolate);

            Assert.AreEqual("Chocolate, Milk", milkHotChocolate.Ingredients);
        }
Exemplo n.º 8
0
        public ChocolateDrinkDecorator(IDrink drink, bool isDeluxe) : base(drink)
        {
            hotChocolate = new HotChocolate();

            if (isDeluxe)
            {
                hotChocolate.MakeDeluxe();
            }

            this.Name  = hotChocolate.GetNameOfDrink();
            this.Price = hotChocolate.Cost();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            var espresso = new Espresso();

            Console.WriteLine(espresso.GetDescription());
            Console.WriteLine(espresso.Cost());
            var espressoWithChoc = new HotChocolate(espresso);

            Console.WriteLine(espressoWithChoc.GetDescription());
            Console.WriteLine(espressoWithChoc.Cost());
            var espressoWithChockAndDoubleSyrop =
                new MapleSyrup(new MapleSyrup(espressoWithChoc));

            Console.WriteLine(espressoWithChockAndDoubleSyrop.GetDescription());
            Console.WriteLine(espressoWithChockAndDoubleSyrop.Cost());
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            BeverageBase capuccino     = new Capuccino();
            BeverageBase tea           = new Tea();
            BeverageBase hot_chololate = new HotChocolate();
            BeverageBase espresso      = new Espresso();


            List <BeverageBase> beverage_list = new List <BeverageBase>();

            beverage_list.Add(capuccino);
            beverage_list.Add(tea);
            beverage_list.Add(hot_chololate);
            beverage_list.Add(espresso);


            foreach (BeverageBase beverage in beverage_list)
            {
                Console.WriteLine("Beverage: {0}, price: {1}", beverage.GetDescription(), beverage.GetPrice());
                Console.WriteLine();
            }



            Console.WriteLine("______________________________");



            BeverageBase green_tea = new GreenTea();


            BeverageBase capuccino2 = new AdditionSugar(new AdditionMilk(new Espresso()));


            beverage_list.Add(capuccino2);


            foreach (BeverageBase beverage in beverage_list)
            {
                Console.WriteLine("Beverage: {0}, price: {1}", beverage.GetDescription(), beverage.GetPrice());
                Console.WriteLine();
            }



            Console.ReadKey();
        }
Exemplo n.º 11
0
        static void makeDrink(string choice)
        {
            switch (choice)
            {
            case "1":
                HotChocolate hotChocolate = new HotChocolate();
                hotChocolate.ReadyWaterBase();
                hotChocolate.AddIngredients();
                hotChocolate.AddWaterBase();
                break;

            case "2":
                Console.Write("How many cubes of sugar? :");
                String sugarQuantity = Console.ReadLine();
                try {
                    WhiteCoffee whiteCoffee = new WhiteCoffee(int.Parse(sugarQuantity));
                    whiteCoffee.ReadyWaterBase();
                    whiteCoffee.AddIngredients();
                    whiteCoffee.AddWaterBase();
                    whiteCoffee.addMilk();
                }
                catch (FormatException) {
                    Console.Write("You entered an incorrect amount..");
                }
                break;

            case "3":
                LemonTea lemonTea = new LemonTea();
                lemonTea.ReadyWaterBase();
                lemonTea.AddWaterBase();
                lemonTea.addTeaBag();
                lemonTea.AddIngredients();
                break;

            case "4":
                IcedCoffee icedCoffee = new IcedCoffee();
                icedCoffee.ReadyWaterBase();
                icedCoffee.AddWaterBase();
                icedCoffee.AddIngredients();
                icedCoffee.blend();
                break;
            }
        }
Exemplo n.º 12
0
 public HotChocolateWrapper(HotChocolate choco)
 {
     _hotChocolate = choco;
     Name          = choco.GetNameOfDrink();
     BasePrice     = 1.20;
 }
Exemplo n.º 13
0
 public HotChocolateDeluxeDecorator(IHotChocolateDrinkAdapter drink) : base(drink)
 {
     HotChocolate.MakeDeluxe();
 }
Exemplo n.º 14
0
 public ChocolateAdapter()
 {
     _adaptee = new HotChocolate();
 }
Exemplo n.º 15
0
 public HotChocolateDrinkAdapter()
 {
     _hotChocolate = new HotChocolate();
 }
Exemplo n.º 16
0
        public void Computes_Hot_Chocolate_With_Cream_Price()
        {
            IBeverage hotChocolateWithCream = new HotChocolate(new CreamSupplement());

            hotChocolateWithCream.Price().Should().BeApproximately(1.6, 0.001);
        }
Exemplo n.º 17
0
        public void Computes_Hot_Chocolate_Price()
        {
            IBeverage hotChocolate = new HotChocolate();

            hotChocolate.Price().Should().BeApproximately(1.45, 0.001);
        }
Exemplo n.º 18
0
 public HotChocolateAdapter(IDrink drink) : base(drink)
 {
     _hotChocolate = new HotChocolate();
 }
Exemplo n.º 19
0
        public void ComputesHotChocolateWithCreamPrice()
        {
            var hotChocolateWithCream = new HotChocolate(_supplement);

            Assert.Equal(1.60, hotChocolateWithCream.PriceWithCream(), 3);
        }
Exemplo n.º 20
0
        public void ComputesHotChocolatePrice()
        {
            var hotChocolate = new HotChocolate(_supplement);

            Assert.Equal(1.45, hotChocolate.Price(), 3);
        }
Exemplo n.º 21
0
 public ChocolateAdapter(IDrink iDrink) : base(iDrink)
 {
     chocolate = new HotChocolate();
 }