Exemplo n.º 1
0
        public void AddFunds_DenominationNotNull_UpdatesAvailableFunds()
        {
            foreach (var denomination in Denomination.GetAll())
            {
                AddRandomFunds();

                var originalFunds = _transactionHandler.AvailableFunds;

                _transactionHandler.AddFunds(denomination);

                var priceDifference = _transactionHandler.AvailableFunds - originalFunds;

                Assert.AreEqual(denomination.Value, priceDifference);

                _transactionHandler.CompleteOrder();
            }
        }
Exemplo n.º 2
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            var change = _transactionHandler.CompleteOrder();

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

            var message = "Have a nice day!";

            if (change > 0)
            {
                message = $"Your change is: {change:C}\n\n{message}";
            }

            MessageBox.Show(message, "Thank you!");
        }