Пример #1
0
        public void DecoratorPatter_GetIngredient_thinCrust_Onion()
        {
            ThinCrust           thinCrust           = new ThinCrust();
            OnionPizzaDecorator onionPizzaDecorator = new OnionPizzaDecorator(thinCrust);

            var response = onionPizzaDecorator.GetIngrendients();

            Assert.Equal(2, response.Count);
            Assert.Contains("wheat", response);
            Assert.Contains("onion", response);
        }
Пример #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);
        }
Пример #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);
        }