예제 #1
0
        public void DrinkDecoratorAddsIce()
        {
            Drink          drink          = barman.MakeDrink(ScrewdriverBuilder.Builder);
            DrinkDecorator decoratedDrink = new DrinkDecorator(drink);

            decoratedDrink.Decorate();

            Assert.That(decoratedDrink.WithIce);
        }
예제 #2
0
        public void DrinkDecoratorMakesItMoreExpensive()
        {
            Drink  drink        = barman.MakeDrink(ScrewdriverBuilder.Builder);
            double initialPrice = drink.Price;

            DrinkDecorator decorator = new DrinkDecorator(drink);

            decorator.Decorate();
            double finalPrice = drink.Price;

            Assert.That(initialPrice + 50 == finalPrice);
        }