public void TestTransferFromChckingToSavings() { AbstractAccount checkingAccount = new CHECKINGAccount(); // Account(Account.CHECKING); AbstractAccount savingsAccount = new SAVINGSAccount(); // Account(Account.SAVINGS); Customer henry = new Customer("Bob").OpenAccount(checkingAccount).OpenAccount(savingsAccount); checkingAccount.Deposit(1000.0); savingsAccount.Deposit(100.0); bool result = henry.Transfer(checkingAccount, savingsAccount, 300); Assert.AreEqual(bool.TrueString, result.ToString()); Assert.AreEqual(700, checkingAccount.sumTransactions()); Assert.AreEqual(400, savingsAccount.sumTransactions()); }
public void TestTransferWhenNotEnoughMoney() { AbstractAccount checkingAccount = new CHECKINGAccount(); // Account(Account.CHECKING); AbstractAccount savingsAccount = new SAVINGSAccount(); // Account(Account.SAVINGS); Customer rich = new Customer("Rich").OpenAccount(checkingAccount).OpenAccount(checkingAccount); rich.OpenAccount(checkingAccount).OpenAccount(savingsAccount); checkingAccount.Deposit(10); savingsAccount.Deposit(5); bool result = rich.Transfer(checkingAccount, savingsAccount, 20); Assert.AreEqual(bool.FalseString, result.ToString()); Assert.AreEqual(10, checkingAccount.sumTransactions()); Assert.AreEqual(5, savingsAccount.sumTransactions()); }