Exemplo n.º 1
0
        public void CafeConHielo()
        {
            BeverageComponent b = new Coffee();

            b = new IceDecorator(b);

            Assert.True(b.getCost() == 2.0);
            Assert.True(b.getDescription() == "Café, con hielo");
        }
Exemplo n.º 2
0
        public void CafeConHieloGrande()
        {
            BeverageComponent b = new Coffee();

            b = new IceDecorator(b);
            b = new GrandSizeDecorator(b);

            Assert.True(b.getCost() == 3.75);
            Assert.True(b.getDescription() == "Café, con hielo, tamaño grande");
        }
Exemplo n.º 3
0
    public void Setup()
    {
        //Create the spell
        ISpell someSpell = new Spell(5);

        //Decorate it with fire damage
        FireDecorator fireDecorator = new FireDecorator(20);

        someSpell = fireDecorator.Decorate(someSpell);

        //Decorate some more with ice damage
        IceDecorator iceDecorator = new IceDecorator(10);

        someSpell = iceDecorator.Decorate(someSpell);

        //Cast the decorated spell (dealing 35 damage with effects: Normal, Fire and Ice)
        someSpell.Cast();
    }