Exemple #1
0
        public void ShouldAddWithdrawHistory()
        {
            TransactionHistory transactionHistory = new TransactionHistory(1000);

            transactionHistory.WithdrawTransaction(100, 900);
            Assert.Equal("Starting balance is 1000\nWithdraw: 100\nCurrent balance is 900\n", transactionHistory.history);
        }
Exemple #2
0
 public void WithdrawMoney(double amount)
 {
     if (balance > amount)
     {
         balance -= amount;
         transactionHistory.WithdrawTransaction(amount, balance);
     }
     else if (balance < amount)
     {
         throw new Exception("whoops, you do not own that much money");
     }
     else
     {
         throw new Exception("whoops, Invalid Input");
     }
 }