Пример #1
0
        public void DecoratorPatter_GetIngredient_thikCrust()
        {
            ThikCrust thikCrust = new ThikCrust();

            var response = thikCrust.GetIngrendients();

            Assert.Equal(2, response.Count);
            Assert.Contains("wheat", response);
            Assert.Contains("extra wheat", response);
        }
Пример #2
0
        public void DecoratorPatter_GetIngredient_thikCrust_Cheese()
        {
            ThikCrust            thikCrust            = new ThikCrust();
            CheesePizzaDecorator cheesePizzaDecorator = new CheesePizzaDecorator(thikCrust);

            var response = cheesePizzaDecorator.GetIngrendients();

            Assert.Equal(3, response.Count);
            Assert.Contains("wheat", response);
            Assert.Contains("extra wheat", response);
            Assert.Contains("cheese", response);
        }
Пример #3
0
        public void DecoratorPatter_GetIngredient_thikCrust_Onion()
        {
            ThikCrust           thikCrust           = new ThikCrust();
            OnionPizzaDecorator onionPizzaDecorator = new OnionPizzaDecorator(thikCrust);

            var response = onionPizzaDecorator.GetIngrendients();

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