示例#1
0
        public void CanViewSales()
        {
            //Given
            var store    = new Store();
            var address1 = new Address("test1", "city1");

            store.Address = address1;
            var order1    = new Order();
            var pizza1    = new Standard().Make() as Pizza;
            var pizza2    = new NewYork().Make() as Pizza;
            var pizzaList = new List <ISellable> {
                pizza1, pizza2
            };

            order1.AddToOrderItems(pizzaList);

            var addressedOrder = new AddressedOrder(address1, order1);

            store.StoreOrderHistory.Add(addressedOrder);
            //When
            var expectedTotal = pizza1.Price + pizza2.Price;
            var actual        = store.ViewSales();
            var expected      = new List <Sale> {
                new Sale(order1, addressedOrder.Date, expectedTotal)
            };

            //Then
            Assert.True(actual.Count == expected.Count && expectedTotal == actual[0].Price && expected[0].Date == actual[0].Date);
        }
        public EmbedBuilder BuildEmbed()
        {
            var eb = new EmbedBuilder
            {
                Title = "Sign up to " + exchange
            };

            if (TimeSpan.Days == 0 && TimeSpan.Hours != 0 || TimeSpan.Days == 0 && TimeSpan.Minutes != 0)
            {
                eb.WithAuthor("Pump will be in " + TimeSpan.Hours + " hours and " + TimeSpan.Minutes + " minutes.");
            }
            else
            {
                eb.WithAuthor("Pump will be in " + TimeSpan.Days + " days, " + TimeSpan.Hours + " hours and " + TimeSpan.Minutes + " minutes.");
            }

            eb.Url          = exchangeReferralLink;
            eb.ThumbnailUrl = "https://puu.sh/zbrt1/01c3a7da72.png";
            eb.Description  = "**" +
                              London.ToString("HH:mm" + " ") + London.DayOfWeek.ToString().Substring(0, 3) + London.ToString(", MMM d tt") + "GMT (London)\n" +
                              NewYork.ToString("HH:mm" + " ") + NewYork.DayOfWeek.ToString().Substring(0, 3) + NewYork.ToString(", MMM d tt") + "EST (New York)\n" +
                              Sweden.ToString("HH:mm" + " ") + Sweden.DayOfWeek.ToString().Substring(0, 3) + Sweden.ToString(", MMM d tt") + "CET (Sweden)\n" +
                              Seoul.ToString("HH:mm" + " ") + Seoul.DayOfWeek.ToString().Substring(0, 3) + Seoul.ToString(", MMM d tt") + "GMT+9 (Seoul)" + "**";
            eb.WithFooter("Countdown can be found on my status, on the right side bar. \n Pump will be on " + exchange + ". Make sure to sign up and transfer funds. We will trade using BTC Pairing.");
            eb.WithColor(10957198);
            return(eb);
        }
示例#3
0
        public void Test_Toppings()
        {
            //Arrange
            NewYork ny        = new NewYork();
            var     truepizza = ny.Make();
            var     e1        = "Mushrooms";
            //Act
            var a1 = truepizza.Toppings[3].Name;

            //Assert
            Assert.True(e1.CompareTo(a1) == 0);
        }
示例#4
0
        public static APizza MakeNewYorkPizza(List <string> tops)
        {
            List <Toppings> toppings = new List <Toppings>();

            for (int i = 0; i < tops.Count; i++)
            {
                toppings.Add(GetTopping(tops[i]));
            }

            var NY = new NewYork(toppings);

            return(NY);
        }
示例#5
0
        public void Test_Crust()
        {
            //Arrange
            NewYork ny        = new NewYork();
            var     truepizza = ny.Make();
            var     expected  = "Deep Dish";
            //Act
            var act = truepizza.Crust.Name;

            System.Console.WriteLine(act + " " + expected);
            //Assert
            Assert.True(expected.CompareTo(act) == 0);
        }
示例#6
0
        public void Test_Price()
        {
            //Arrange
            NewYork ny        = new NewYork();
            var     truepizza = ny.Make();
            var     expected  = 7;
            //Act
            var act = truepizza.TotalPrice;

            //System.Console.WriteLine(act + " "+expected );
            //Assert

            Assert.True(expected == act);
        }
示例#7
0
        public void Test_DefaultSize()
        {
            //Arrange
            NewYork ny        = new NewYork();
            var     truepizza = ny.Make();
            var     expected  = "Large";
            //Act
            var act = truepizza.Size.Name;

            //System.Console.WriteLine(act + " "+expected );
            //Assert

            Assert.True(expected.CompareTo(act) == 0);
        }
示例#8
0
        public void MakeNewYork()
        {
            var ny = new NewYork();

            ny.Make(
                new Size("Small", 5),

                new List <Topping>
            {
                new Topping("Pepperoni", 2),
                new Topping("Sausage", 2)
            }
                );
        }
示例#9
0
        public void Test_Order_Compute_Total()
        {
            Order testOrder = new Order();

            var ny = new NewYork();

            var store = new Store(new List <AIngredient>()
            {
                new Crust("New York Style", 0M, 100), new Sauce("Tomato", 0M, 100), new Topping("Pepperoni", 0M, 200), new Topping("Mozzarella cheese", 0M, 200)
            }, new Location("1234 UTA Blvd", null, "Arlington", "Texas", 76016));
            var size     = new Size("Medium", 7.99M);
            var testList = new List <Topping>();

            ny.Make(store, size, testList, out ComponentList, out PizzaCost);
            testOrder.AddPizza(ComponentList);

            ny.Make(store, size, testList, out ComponentList, out PizzaCost);
            testOrder.AddPizza(ComponentList);

            ny.Make(store, size, testList, out ComponentList, out PizzaCost);
            testOrder.AddPizza(ComponentList);

            Assert.True(testOrder.ComputeTotal() == 23.97M);
        }
        public void CreatePresetPizza()
        {
            System.Console.Write("What kind of preset?: ");
            string presetType = System.Console.ReadLine();

            APizzaFactory factory;

            switch (presetType)
            {
            case "newyork":
                factory = new NewYork();
                break;

            case "chicago":
                factory = new Chicago();
                break;

            default:
                factory = new NewYork();
                System.Console.WriteLine("Please enter 'chicago' or 'newyork' and try again...");
                break;
            }

            int sizeId, topping1Id, topping2Id;

            Data.Entities.Size    pizzaSize;
            Data.Entities.Topping pizzaTopping1, pizzaTopping2;
            Pizza pizza;

            System.Console.WriteLine("Selecting size...");
            foreach (Data.Entities.Size s in _db.Size.ToList())
            {
                System.Console.WriteLine($"{s.SizeId}: {s.Name} ${s.Price}");
            }
            System.Console.Write("Enter size id: ");
            sizeId    = System.Convert.ToInt32(System.Console.ReadLine());
            pizzaSize = _db.Size.Find(sizeId);
            if (pizzaSize == null)
            {
                System.Console.WriteLine("Please enter a valid id and try again...");
                return;
            }


            System.Console.WriteLine("Selecting toppings...");
            foreach (Data.Entities.Topping t in _db.Topping.ToList())
            {
                System.Console.WriteLine($"{t.ToppingId}: {t.Name} ${t.Price}");
            }

            System.Console.Write("Enter first topping id: ");
            topping1Id    = System.Convert.ToInt32(System.Console.ReadLine());
            pizzaTopping1 = _db.Topping.Find(topping1Id);

            System.Console.Write("Enter second topping id: ");
            topping2Id    = System.Convert.ToInt32(System.Console.ReadLine());
            pizzaTopping2 = _db.Topping.Find(topping2Id);


            List <Topping> toppingList = new List <Topping>();

            if (pizzaTopping1 != null)
            {
                toppingList.Add(new Topping(pizzaTopping1.Name, pizzaTopping1.Price)
                {
                    Id = topping1Id
                });
            }
            if (pizzaTopping2 != null)
            {
                toppingList.Add(new Topping(pizzaTopping2.Name, pizzaTopping2.Price)
                {
                    Id = topping2Id
                });
            }

            pizza = factory.Make(new Size(pizzaSize.Name, pizzaSize.Price)
            {
                Id = sizeId
            }, toppingList);
            pizza.CalculatePrice();
            _user.CurrentOrder.AddToOrder(pizza);
        }
示例#11
0
        public Order OrderFromStore(Store store, User user)
        {
            System.Console.WriteLine($"Based on your location, you'll be ordering from the store at {store.StoreLocation.Address1}.");

            System.Console.WriteLine("What kind of pizza do you want?");
            System.Console.WriteLine("New York Style or Deep Dish Style");
            var type = System.Console.ReadLine();

            while (store.Inventory.OfType <Crust>().FirstOrDefault(t => t.Name == type) == null)
            {
                System.Console.WriteLine("That's not in the options.");
                System.Console.WriteLine("What kind of pizza do you want?");

                type = System.Console.ReadLine();
            }

            System.Console.WriteLine("What size would you like?");
            System.Console.WriteLine("Small, Medium, Large, or X-Large");
            var size = System.Console.ReadLine();

            while (_possibleSizes.FirstOrDefault(s => s.Name == size) == null)
            {
                System.Console.WriteLine("That's not a valid size.");
                System.Console.WriteLine("What size would you like (Small, Medium, Large, X-Large)?");

                size = System.Console.ReadLine();
            }

            System.Console.WriteLine("What kind of toppings do you want? (you'll only be able to have up to 5 and all pizzas come with pepperoni and mozzarella cheese)");
            System.Console.WriteLine("Mushroom, Sausage, Canadian Bacon");
            var topping = System.Console.ReadLine();

            while (store.Inventory.OfType <Topping>().FirstOrDefault(t => t.Name == topping) == null)
            {
                System.Console.WriteLine("That's not in the options.");
                System.Console.WriteLine("What kind of toppings do you want?");

                topping = System.Console.ReadLine();
            }

            var selectedToppings = new List <Topping> {
                store.Inventory.OfType <Topping>().FirstOrDefault(t => t.Name == topping)
            };

            if (type == "Deep Dish Style")
            {
                var deepDish = new DeepDish();
                List <AIngredient> pi;
                decimal            total;

                deepDish.Make(store, _possibleSizes.FirstOrDefault(s => s.Name == size), selectedToppings, out pi, out total);

                System.Console.WriteLine("Order created!");

                return(new Order(store, user, new List <List <AIngredient> > {
                    pi
                }));
            }

            var nyStyle = new NewYork();
            List <AIngredient> pizza;
            decimal            cost;

            nyStyle.Make(store, _possibleSizes.FirstOrDefault(s => s.Name == size), selectedToppings, out pizza, out cost);

            System.Console.WriteLine("Order created!");

            return(new Order(store, user, new List <List <AIngredient> > {
                pizza
            }));
        }
示例#12
0
 static void MakeNewYorkPizza()
 {
     var ny1 = new NewYork();
     var ny2 = new NewYork();
 }