public void ReturnSmallPizzaWithSpecialCrustCost_WhenGetCostIsCalled()
        {
            var expectedCost   = 6.0;
            var smallPizza     = new SmallPizza();
            var crustDecorator = new CrustDecorator(smallPizza, Crusts.Stuffed);

            var actualCost = crustDecorator.GetCost();

            actualCost.Should().Be(expectedCost);
        }
        public void ReturnSmallPizzaWithStandardCrustCost_WhenGetCostIsCalled()
        {
            var expectedCost   = 5.0;
            var smallPizza     = new SmallPizza();
            var crustDecorator = new CrustDecorator(smallPizza, Crusts.Classic);

            var actualCost = crustDecorator.GetCost();

            actualCost.Should().Be(expectedCost);
        }
        public void ReturnSmallPizzaWithCrustDescription_WhenGetDescriptionIsCalled()
        {
            var expectedDescription = "Small Pizza\r\n\t- Classic crust";
            var smallPizza          = new SmallPizza();
            var crustDecorator      = new CrustDecorator(smallPizza, Crusts.Classic);

            var actualDescription = crustDecorator.GetDescription();

            actualDescription.Should().Be(expectedDescription);
        }
Example #4
0
        public void CreateSmallPizzaWithSauceAndCrust_WhenWithCrustIsCalled()
        {
            var sauce               = Sauces.Tomato;
            var crust               = Crusts.Classic;
            var smallPizza          = new SmallPizza();
            var smallPizzaWithSauce = new SauceDecorator(smallPizza, sauce);
            var expectedPizza       = new CrustDecorator(smallPizzaWithSauce, crust);
            var customPizza         = new PizzaBuilder();

            customPizza.CreatePizzaWithSize(Size.Small)
            .WithSauce(sauce)
            .WithCrust(crust);
            var actualPizza = customPizza.Bake();

            actualPizza.Should().BeEquivalentTo(expectedPizza);
        }
Example #5
0
        public void CreateSmallPizzaWithOneTopping_WhenWithToppingIsCalledOnce()
        {
            var sauce                       = Sauces.Tomato;
            var crust                       = Crusts.Classic;
            var topping                     = Toppings.Mozzarella;
            var smallPizza                  = new SmallPizza();
            var smallPizzaWithSauce         = new SauceDecorator(smallPizza, sauce);
            var smallPizzaWithSauceAndCrust = new CrustDecorator(smallPizzaWithSauce, crust);
            var expectedPizza               = new ToppingDecorator(smallPizzaWithSauceAndCrust, topping);
            var customPizza                 = new PizzaBuilder();

            customPizza.CreatePizzaWithSize(Size.Small)
            .WithSauce(sauce)
            .WithCrust(crust)
            .AddTopping(topping);
            var actualPizza = customPizza.Bake();

            actualPizza.Should().BeEquivalentTo(expectedPizza);
        }