Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
 /// <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;
 }
Exemplo n.º 5
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();
 }
Exemplo n.º 7
0
 public Pizza(PizzaBase pizzaBase, PizzaTopping pizzaTopping)
 {
     PizzaBase    = pizzaBase;
     PizzaTopping = pizzaTopping;
 }
Exemplo n.º 8
0
 public Pizza()
 {
     Base = PizzaBase.Regular;
 }
Exemplo n.º 9
0
 public PizzaNameCommand(PizzaBase pizza)
 {
     this.pizza = pizza ?? throw new ArgumentNullException(nameof(pizza), " was null.");
 }
Exemplo n.º 10
0
 public PizzaDecorator(PizzaBase pizza) : base(pizza.SaborEscolhido())
 {
     _pizza           = pizza;
     _personalizacoes = new List <IPersonalizacao>();
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creats the pizza object that will be used for all the tests.
 /// </summary>
 public CheesePizzaTests()
 {
     cheesePizza = new CheesePizza();
 }
Exemplo n.º 12
0
 public Pizza(PizzaBase @base, string toppings)
 {
     m_base     = @base;
     m_toppings = toppings;
 }
Exemplo n.º 13
0
        public PaneerPizzaDecorator(PizzaBase pizzaBase) : base(pizzaBase)
        {
            Topping paneerTopping = new PaneerTikka();

            AddTopping(paneerTopping);
        }
 public PizzaDecorator(PizzaBase pizzaBaseImplementation)
 {
     this._pizzaBaseImplementation = pizzaBaseImplementation;
 }
Exemplo n.º 15
0
 public SalamiIngredient(PizzaBase pizzaBase) : base(pizzaBase)
 {
 }
Exemplo n.º 16
0
 public CheeseIngredient(PizzaBase pizzaBase) : base(pizzaBase)
 {
 }
Exemplo n.º 17
0
 public void CriarPizza(TipoPizza tipoPizza, TamanhoPizza tamanho)
 {
     _pizza = _pizzaFactory.CriarPizzaEspecifica(tipoPizza, tamanho);
     _pizza.AssarPizza();
     _pizza.DeliveryPizza();
 }
Exemplo n.º 18
0
 public VeggiePizzaTests()
 {
     vegiePizza = new VeggiePizza();
 }
Exemplo n.º 19
0
 public IngredientBase(PizzaBase pizzaBase)
 {
     _pizzaBase = pizzaBase;
 }
 public CheeseDecorator(PizzaBase pizzaBaseImplementation) : base(pizzaBaseImplementation)
 {
 }
Exemplo n.º 21
0
        public ChickenPizzaDecorator(PizzaBase pizzaBase) : base(pizzaBase)
        {
            Topping chickenSausage = new ChickenSausages();

            AddTopping(chickenSausage);
        }
Exemplo n.º 22
0
 public void updatePizzaBase(int PBID, PizzaBase s)
 {
     throw new NotImplementedException();
 }