public async Task ProcessOrderAsync_Success() { // Assume var pizzaBase = new PizzaBase("Gluten-Free", 2.5); var pizzaOrder = new PizzaOrder( pizzaBase, "Tuna"); var dummyToken = CancellationToken.None; double expectedCookingTimeMs = (2.5 * 3000) + (4 * 100); MockPizzaOven.Setup( o => o.CookAsync( It.IsAny <IPizzaOrder>(), It.IsAny <double>(), It.IsAny <CancellationToken>())) .Returns( Task.FromResult(true)); // Act var pizzaKitchen = new PizzaKitchen( MockPizzaOven.Object, MockLogger.Object); await pizzaKitchen.ProcessOrderAsync( pizzaOrder, dummyToken); // Assert MockPizzaOven.Verify( o => o.CookAsync( pizzaOrder, expectedCookingTimeMs, dummyToken), Times.Once); MockLogger.Verify( l => l.Debug( "Calculated total cooking time for pizza: {0}ms", expectedCookingTimeMs), Times.Once); }
public void ChangePizzaBase(PizzaBase baseChangeTo) { Base = baseChangeTo; if (Base == PizzaBase.Regular) { if (PizzaType == PizzaType.PestoWhitePan) { PizzaType = PizzaType.SatchPan; } else if (PizzaType == PizzaType.PestoWhiteMedium) { PizzaType = PizzaType.Medium; } else if (PizzaType == PizzaType.PestoWhiteLarge) { PizzaType = PizzaType.Large; } } else { if (PizzaType == PizzaType.SatchPan) { PizzaType = PizzaType.PestoWhitePan; } else if (PizzaType == PizzaType.Medium) { PizzaType = PizzaType.PestoWhiteMedium; } else if (PizzaType == PizzaType.Large) { PizzaType = PizzaType.PestoWhiteLarge; } } //Base price and toppings price will change due to the base change. PopulateBasePrice(); Toppings.UpdateToppingsTotal(); }
/// <summary> /// Sets the current pizza out from the chosen pizza on the pizza combobox. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PizzaType_SelectionChanged(object sender, SelectionChangedEventArgs e) { ResetIndexes(); sizePricePizza.TryGetValue(sizePizza, out float value); int index = PizzaType.SelectedIndex; if (index == 0) { currentPizza = null; PriceBox.Text = "0 kr"; IngredientsBox.Text = ""; } else { //prePizzaList[index-1]; //minus 1 because there is one more option in the combobox, "None", than there are pizzas. currentPizza = new PizzaPolymorth(PriceBox, IngredientsBox, prePizzaList[index - 1].GetName, prePizzaList[index - 1].GetNumber, prePizzaList[index - 1].GetIngredientsDictionary); //prevents overwriting the "base" pizzas dough.TryGetValue(prePizzaList[index - 1].GetDough, out float valuePrice); currentPizza.SetBasePrice = value; currentPizza.SetDough(prePizzaList[index - 1].GetDough, valuePrice); currentPizza.SetCheese(prePizzaList[index - 1].GetCheese, valuePrice); currentPizza.SetTomatoSauce(prePizzaList[index - 1].GetTomatoSauce, valuePrice); } }
/// <summary> /// Resests list of added pizzas, drinks, indexes, and values regarding the textboxes, and the textboxes themselves. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Order_Click(object sender, RoutedEventArgs e) { TotalPriceBox.Text = "0 kr"; allDrinks.Clear(); allPizza.Clear(); pizzaNames.Clear(); drinkNames.Clear(); PizzaListBox.Text = ""; if (currentDrink != null) { currentDrink = null; } if (currentPizza != null) { currentPizza = null; } ResetDrinkIndexes(); ResetIndexes(); PizzaType.SelectedIndex = 0; discount = false; mostExpensiveDough_Name = null; mostExpensiveDough_Price = null; finalPrice = 0; }
public Pizza(PizzaBase @base, string toppings) { m_base = @base; m_toppings = toppings; }
/// <summary> /// Creats the pizza object that will be used for all the tests. /// </summary> public PepperoniPizzaTests() { pepperoniPizza = new PepperoniPizza(); }
public Pizza(PizzaBase pizzaBase, PizzaTopping pizzaTopping) { PizzaBase = pizzaBase; PizzaTopping = pizzaTopping; }
public Pizza() { Base = PizzaBase.Regular; }
public PizzaNameCommand(PizzaBase pizza) { this.pizza = pizza ?? throw new ArgumentNullException(nameof(pizza), " was null."); }
public PizzaDecorator(PizzaBase pizza) : base(pizza.SaborEscolhido()) { _pizza = pizza; _personalizacoes = new List <IPersonalizacao>(); }
/// <summary> /// Creats the pizza object that will be used for all the tests. /// </summary> public CheesePizzaTests() { cheesePizza = new CheesePizza(); }
public Pizza(PizzaBase @base, string toppings) { m_base = @base; m_toppings = toppings; }
public PaneerPizzaDecorator(PizzaBase pizzaBase) : base(pizzaBase) { Topping paneerTopping = new PaneerTikka(); AddTopping(paneerTopping); }
public PizzaDecorator(PizzaBase pizzaBaseImplementation) { this._pizzaBaseImplementation = pizzaBaseImplementation; }
public SalamiIngredient(PizzaBase pizzaBase) : base(pizzaBase) { }
public CheeseIngredient(PizzaBase pizzaBase) : base(pizzaBase) { }
public void CriarPizza(TipoPizza tipoPizza, TamanhoPizza tamanho) { _pizza = _pizzaFactory.CriarPizzaEspecifica(tipoPizza, tamanho); _pizza.AssarPizza(); _pizza.DeliveryPizza(); }
public VeggiePizzaTests() { vegiePizza = new VeggiePizza(); }
public IngredientBase(PizzaBase pizzaBase) { _pizzaBase = pizzaBase; }
public CheeseDecorator(PizzaBase pizzaBaseImplementation) : base(pizzaBaseImplementation) { }
public ChickenPizzaDecorator(PizzaBase pizzaBase) : base(pizzaBase) { Topping chickenSausage = new ChickenSausages(); AddTopping(chickenSausage); }
public void updatePizzaBase(int PBID, PizzaBase s) { throw new NotImplementedException(); }