public void CheeseCrustPriceCheck()
        {
            var prebuiltPrice = 4.00m;
            var expected      = prebuiltPrice + 5m;
            var pizza         = new PrebuiltPizza("Personal Plain", "Hand Tossed", "Personal", new List <string>(), prebuiltPrice, 73857);

            var actual = pizza.GetPrice();

            Assert.Equal(expected, actual);
        }
        public void XLPriceCheck()
        {
            var prebuiltPrice = 2.50m;
            var expected      = prebuiltPrice + 15m;
            var pizza         = new PrebuiltPizza("Personal Plain", "Hand Tossed", "Personal", new List <string>(), prebuiltPrice, 1497522);

            var actual = pizza.GetPrice();

            Assert.Equal(expected, actual);
        }
        public void MediumPriceCheck()
        {
            var prebuiltPrice = 1.50m;
            var expected      = prebuiltPrice + 9m;
            var pizza         = new PrebuiltPizza("Medium Plain", "Hand Tossed", "Medium", new List <string>(), prebuiltPrice, 4125);

            var actual = pizza.GetPrice();

            Assert.Equal(expected, actual);
        }
示例#4
0
        public void LargePriceCheck()
        {
            var prebuiltPrice = 2.00m;
            var expected      = prebuiltPrice + 12m;
            var pizza         = new PrebuiltPizza("Personal Plain", "Hand Tossed", "Personal", new List <string>(), prebuiltPrice, 8354);

            var actual = pizza.Price;

            Assert.Equal(expected, actual);
        }
示例#5
0
 public void Save(PrebuiltPizza pizza)
 {
     _ctx.PrebuiltPizzas.Add(pizza);
     try
     {
         _ctx.SaveChanges();
     }
     finally
     {
         _ctx.Database.CloseConnection();
     }
 }
示例#6
0
        public void PrebuiltPizza()
        {
            if (ReadPrebuiltPizzas().Count() == 0)
            {
                Console.WriteLine("No Pizza found in DB! Adding pizzas");
                Crust          c  = ReadCrust().FirstOrDefault(x => x.Name.Contains("Hand Tossed"));
                Size           s  = ReadSize().FirstOrDefault(x => x.Name.Contains("Medium"));
                Topping        t1 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Premium Chicken"));
                Topping        t2 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Cheese"));
                List <Topping> t  = new List <Topping> {
                    t1, t2
                };
                PrebuiltPizza meatpizza1 = new PrebuiltPizza(c, s, t);
                meatpizza1.Name = "Medium Hand Tossed Meat Pizza";
                Save(meatpizza1);


                c  = ReadCrust().FirstOrDefault(x => x.Name.Contains("Cheese-Stuffed"));
                s  = ReadSize().FirstOrDefault(x => x.Name.Contains("Large"));
                t1 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Premium Chicken"));
                t2 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Cheese"));
                Topping t3 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Pulled Pork"));
                Topping t4 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Mushroom"));
                t = new List <Topping> {
                    t1, t2, t3, t4
                };
                PrebuiltPizza meatpizza2 = new PrebuiltPizza(c, s, t);
                meatpizza2.Name = "Large Cheese Stuffed King of Pizza";
                Save(meatpizza2);

                c  = ReadCrust().FirstOrDefault(x => x.Name.Contains("Thin"));
                s  = ReadSize().FirstOrDefault(x => x.Name.Contains("Small"));
                t1 = ReadTopping().FirstOrDefault(x => x.Name.Contains("Cheese"));
                t  = new List <Topping> {
                    t1
                };
                PrebuiltPizza cheesepizza = new PrebuiltPizza(c, s, t);
                cheesepizza.Name = "Small thin crust cheese pizza";
                Save(cheesepizza);
            }
            else
            {
                Console.WriteLine("All set! Welcome to the Pizza Ordering App!");
            }
        }
 public void AddPrebuiltPizza(PrebuiltPizza prebuiltPizza)
 {
     PrebuiltPizzas.Add(prebuiltPizza);
     SavePizzas();
 }