Exemplo n.º 1
0
        public void Test_OrderAddPizza()
        {
            CustomPizza tempP = new CustomPizza();

            tempP.Type = "Meat Pizza";
            tempP.AddCrust(new Crust("regular", 1.0m));
            tempP.AddSize(new Size("medium", 4.0m));
            tempP.AddTopping(new Topping("beef", 0.66m));
            tempP.AddTopping(new Topping("chicken", 1.0m));
            tempP.AddTopping(new Topping("ham", 0.75m));
            tempP.AddTopping(new Topping("mushroom", 0.50m));
            tempP.AddTopping(new Topping("olive", 0.33m));

            decimal TotalPrice = 1.0m + 4.0m + 0.66m + 1.0m + 0.75m + 0.50m + 0.33m;

            var expected = "Meat Pizza : medium : regular : beef chicken ham mushroom olive - " + TotalPrice;

            Order sut = new Order();

            sut.AddPizza(tempP);

            var actual = sut.Pizzas[0].ToString();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        private static APizza SelectCustomPizza()
        {
            var pizza = new CustomPizza();

            System.Console.WriteLine("Select a crust:");
            PrintCrust();
            var crust = SelectCrust();

            System.Console.WriteLine("Select a size:");
            PrintItems(_sizeSingleton.Sizes);
            var size = SelectSize();

            var toppingCount = 0;

            var toppings = new List <Topping>();

            System.Console.WriteLine("Select toppings:");
            PrintItems(_toppingSingleton.Toppings);
            toppings.Add(SelectToppings());
            System.Console.WriteLine("Add more toppings? (Y/N) ");
            var stop = Console.ReadLine();

            while (stop != "n")
            {
                PrintItems(_toppingSingleton.Toppings);
                toppings.Add(SelectToppings());
                toppingCount++;
                if (toppingCount == 2)
                {
                    System.Console.WriteLine("You can no longer add toppings!");
                    break;
                }
                System.Console.WriteLine("Add another topping? (Y/N)");
                stop = Console.ReadLine();
            }

            pizza.AddCrust(crust);
            pizza.AddSize(size);
            pizza.AddToppings(toppings.ToArray());


            return(pizza);
        }
Exemplo n.º 3
0
        public void Test_CustomPizza()
        {
            var sut = new CustomPizza();

            sut.AddCrust(new Crust()
            {
                Name = "Thin"
            });

            sut.AddSize(new Size()
            {
                Name = "Large"
            });

            var actual = sut.Crust;


            //Assert.True(sut.Size.Name == "Large");
            Assert.True(actual.Name == "Thin");
        }