Beispiel #1
0
        public void DecoratorPatter_GetIngredient_thinCrust()
        {
            ThinCrust thinCrust = new ThinCrust();

            var response = thinCrust.GetIngrendients();

            Assert.Single(response);
            Assert.Contains("wheat", response);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public void DecoratorPattern_OnionWithCheeseThinCrust()
        {
            ThinCrust            thinCrust            = new ThinCrust();
            CheesePizzaDecorator cheesePizzaDecorator = new CheesePizzaDecorator(thinCrust);
            OnionPizzaDecorator  onionPizzaDecorator  = new OnionPizzaDecorator(cheesePizzaDecorator);

            var respThinCrust                   = thinCrust.GetPrice();
            var respCheeseWithThinCrust         = cheesePizzaDecorator.GetPrice();
            var respOnionWithCheeseAndThinCrust = onionPizzaDecorator.GetPrice();

            Assert.Equal(200, respThinCrust);
            Assert.Equal(300, respCheeseWithThinCrust);
            Assert.Equal(400, respOnionWithCheeseAndThinCrust);
        }