public void ReturnSmallPizzaWithStandardSauceCost_WhenGetCostIsCalled()
        {
            var expectedCost   = 5.25;
            var smallPizza     = new SmallPizza();
            var crustDecorator = new SauceDecorator(smallPizza, Sauces.Tomato);

            var actualCost = crustDecorator.GetCost();

            actualCost.Should().Be(expectedCost);
        }
        public void ReturnSmallPizzaWithSpecialSauceCost_WhenGetCostIsCalled()
        {
            var expectedCost   = 5.5;
            var smallPizza     = new SmallPizza();
            var crustDecorator = new SauceDecorator(smallPizza, Sauces.Barbecue);

            var actualCost = crustDecorator.GetCost();

            actualCost.Should().Be(expectedCost);
        }
        public void ReturnSmallPizzaWithSauceDescription_WhenGetDescriptionIsCalled()
        {
            var expectedDescription = "Small Pizza\r\n\t- Tomato sauce";
            var smallPizza          = new SmallPizza();
            var sauceDecorator      = new SauceDecorator(smallPizza, Sauces.Tomato);

            var actualDescription = sauceDecorator.GetDescription();

            actualDescription.Should().Be(expectedDescription);
        }
示例#4
0
        public void CreateSmallPizzaWithSauce_WhenWithSauceIsCalled()
        {
            var sauce         = Sauces.Tomato;
            var smallPizza    = new SmallPizza();
            var expectedPizza = new SauceDecorator(smallPizza, sauce);
            var customPizza   = new PizzaBuilder();

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

            actualPizza.Should().BeEquivalentTo(expectedPizza);
        }
示例#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);
        }