public void Test_CreatePizza() { // arrange PizzaBox.Storing.Repositories.PizzaRepository pr = new PizzaBox.Storing.Repositories.PizzaRepository(); User user = new User("test"); Store store = new Store("North"); var order = new Order(); order.completed(); string size = "S"; string crust = "Normal"; List <string> toppings = new List <string> { "Chez" }; //action order.CreatePizza("YEET", size, crust, 8.0, toppings); pr.CreateStore(store); pr.CreateUser(user); pr.CreateOrder(order, pr.FindUserId(user.name), pr.FindStoreId(store.Name)); //assert var test = pr.ReadAllStores(); Assert.True(test.Count > 0); }
static void checkout(Store store, Order order, User user) { PizzaBox.Storing.Repositories.PizzaRepository pr = new PizzaBox.Storing.Repositories.PizzaRepository(); if ((order.done == true) && (order.orderPrice() <= (double)order.priceLimit) && (order.Pizzas.Count <= order.pizzaLimit)) { Console.WriteLine("Conditions met to checkout"); store.Orders.Add(order); Console.WriteLine("Order Costs $ " + order.orderPrice()); pr.CreateStore(store); pr.CreateUser(user); pr.CreateOrder(order, pr.FindUserId(user.name), pr.FindStoreId(store.Name)); } else { Console.WriteLine("Conditions NOT met to checkout"); if ((order.done == true)) { Console.WriteLine("Confirm the order is done in the main menu"); } if (order.orderPrice() <= (double)order.priceLimit) { Console.WriteLine("Edit your order to make it less then $250"); } if (order.Pizzas.Count <= order.pizzaLimit) { Console.WriteLine("Edit your order to have less then 50 pizzas"); } } }