public void WithdrawRemovesMoney() { IAccount account = new SavingsAccount(36241604394L, 100.0, new Customer()); service.Withdraw(account, 50.0); Assert.AreEqual(50.0, account.GetAmount()); }
public void DepositAddsMoney() { IAccount account = new SavingsAccount(36241604394L, 100.0, new Customer()); service.Deposit(account, 100.0); Assert.AreEqual(200.0, account.GetAmount()); }
public void TransferWithdrawsAndDeposits() { double initialFromAmount = 1000; double initialToAmount = 500; double amount = 10; IAccount fromAccount = new SavingsAccount(36241604394L, initialFromAmount, new Customer()); IAccount toAccount = new SavingsAccount(36241604394L, initialToAmount, new Customer()); TransferService service = new TransferService(fromAccount, toAccount); try { service.Transfer(amount); } catch (InnsufficientFundsException e) { Assert.Fail("Should not throw an exception"); } Assert.AreEqual(initialFromAmount - amount, fromAccount.GetAmount()); Assert.AreEqual(initialToAmount + amount, toAccount.GetAmount()); }