public void ChickenPizzaPrepareTest()
        {
            PizzaAbstract Pizza = new ChickenPizza();
            string        s     = Pizza.Prepare();

            Assert.AreEqual("Chicken Pizza", s);
        }
Beispiel #2
0
        public void PrintAllPizzas()
        {
            var chicken = new ChickenPizza();
            var pep     = new PepperoniPizza();
            var cheese  = new CheesePizza();

            System.Console.WriteLine("Here are the pizzas this store offers:");
            System.Console.WriteLine(chicken.Name);
            System.Console.WriteLine(pep.Name);
            System.Console.WriteLine(cheese.Name);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            ChickenPizza chickenPizza = new ChickenPizza();
            TomatoPizza  tomatoPizza  = new TomatoPizza();

            CheeseDecorator cheeseDecorator = new CheeseDecorator(chickenPizza);

            Console.WriteLine(cheeseDecorator.DoPizza());

            PepperDecorator pepperDecorator = new PepperDecorator(cheeseDecorator);

            Console.WriteLine(pepperDecorator.DoPizza());

            Console.ReadKey();
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            IPizza myPizza;

            if (radioButton2.Checked)
            {
                //tao pizza goc
                myPizza = new TomatoPizza();
            }
            else
            {
                //tao pizza goc
                myPizza = new ChickenPizza();
            }

            //them thanh phan pepper
            if (numericUpDown1.Value != 0)
            {
                myPizza = createPepperInstansce(myPizza, numericUpDown1.Value);
            }

            //them thanh phan pepper
            if (numericUpDown2.Value != 0)
            {
                myPizza = createCheeseInstansce(myPizza, numericUpDown2.Value);
            }

            //lay danh sach hinh
            List <string> listOrder = myPizza.doPizza();

            //them hinh
            for (int i = 0; i < listOrder.Count; i++)
            {
                PictureBox img = new PictureBox();
                img.Size          = new Size(130, 100);
                img.SizeMode      = PictureBoxSizeMode.StretchImage;
                img.ImageLocation = listOrder[i];
                flowLayoutPanel1.Controls.Add(img);
            }
        }
Beispiel #5
0
        public List <APizzaModel> SelectPizzas()
        {
            bool Leave = true;
            List <APizzaModel>  Pizzas   = new List <APizzaModel>();
            APizzaModel         test     = new ChickenPizza();
            GenericPizzaFactory _factory = new GenericPizzaFactory();

            do
            {
                PrintAllPizzas();
                System.Console.WriteLine("Select a pizza\n 1: Chicken Pizza \n 2: Pepperoni Pizza \n 3: Cheese Pizza \n 5: Finish");
                int.TryParse(Console.ReadLine(), out int input);
                switch (input)
                {
                case 1:
                {
                    var size  = SelectSize();
                    var crust = SelectCrust();
                    var pizza = new ChickenPizza(size, crust);
                    Pizzas.Add(pizza);
                    break;
                }

                case 2:
                {
                    var size  = SelectSize();
                    var crust = SelectCrust();
                    var pizza = new PepperoniPizza(size, crust);
                    Pizzas.Add(pizza);
                    break;
                }

                case 3:
                {
                    var size  = SelectSize();
                    var crust = SelectCrust();
                    var pizza = new CheesePizza(size, crust);
                    Pizzas.Add(pizza);
                    break;
                }

                case 4:
                {
                    break;
                }

                case 5:
                {
                    Leave = false;
                    break;
                }

                default:
                {
                    Console.WriteLine("Please enter a valid choice");
                    break;
                }
                }
            } while (Leave);
            return(Pizzas);
        }
        public void ChickenPizzaCreateTest()
        {
            PizzaAbstract Pizza = new ChickenPizza();

            Assert.IsInstanceOfType(Pizza, typeof(ChickenPizza));
        }