Ejemplo n.º 1
0
        public void Vend_WhenCoffeeOrderInTransactionHandlerAndSufficientFunds_ReturnsCoffeeOrder()
        {
            var coffeeOrder = CreateCoffeeOrder();

            _transactionHandler.AddCoffeeOrder(coffeeOrder);
            _transactionHandler.AddFunds(Denomination.Twenty);

            var vendedCoffeeOrder = _transactionHandler.Vend();

            Assert.AreEqual(coffeeOrder, vendedCoffeeOrder);
        }
Ejemplo n.º 2
0
        private void btnVend_Click(object sender, EventArgs e)
        {
            try
            {
                var coffeeOrder = _transactionHandler.Vend();

                UpdateCurrentPayment();
                UpdateOrder();
                SetStatus();

                MessageBox.Show(coffeeOrder.ToString(), "Here's your coffee! :)");
            }
            catch (InsufficientFundsException ex)
            {
                SetStatus(ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                SetStatus(ex.Message);
            }
        }