Exemple #1
0
        public void DecoratorPatter_GetIngredient_thinCrust_Cheese()
        {
            ThinCrust            thinCrust            = new ThinCrust();
            CheesePizzaDecorator cheesePizzaDecorator = new CheesePizzaDecorator(thinCrust);

            var response = cheesePizzaDecorator.GetIngrendients();

            Assert.Equal(2, response.Count);
            Assert.Contains("wheat", response);
            Assert.Contains("cheese", response);
        }
Exemple #2
0
        public void DecoratorPatter_GetIngredient_thikCrust_Cheese_Onion()
        {
            ThikCrust            thikCrust            = new ThikCrust();
            CheesePizzaDecorator cheesePizzaDecorator = new CheesePizzaDecorator(thikCrust);
            OnionPizzaDecorator  onionPizzaDecorator  = new OnionPizzaDecorator(cheesePizzaDecorator);

            var response = onionPizzaDecorator.GetIngrendients();

            Assert.Equal(4, response.Count);
            Assert.Contains("wheat", response);
            Assert.Contains("extra wheat", response);
            Assert.Contains("cheese", response);
            Assert.Contains("onion", response);
        }
Exemple #3
0
        public void DecoratorPattern_OnionWithCheeseThikCrust()
        {
            ThikCrust            thikCrust            = new ThikCrust();
            CheesePizzaDecorator cheesePizzaDecorator = new CheesePizzaDecorator(thikCrust);
            OnionPizzaDecorator  onionPizzaDecorator  = new OnionPizzaDecorator(cheesePizzaDecorator);

            var respThikCrust                   = thikCrust.GetPrice();
            var respCheeseWithThinCrust         = cheesePizzaDecorator.GetPrice();
            var respOnionWithCheeseAndThinCrust = onionPizzaDecorator.GetPrice();

            Assert.Equal(250, respThikCrust);
            Assert.Equal(350, respCheeseWithThinCrust);
            Assert.Equal(450, respOnionWithCheeseAndThinCrust);
        }