Exemplo n.º 1
0
        public void TestTransferFunds()
        {
            Customer oscar = new Customer("Oscar");
            IAccount oscarsChecking = new CheckingAccount(); //Account(Account.CHECKING);
            IAccount oscarsSavings = new SavingsAccount();
            oscar.OpenAccount(oscarsChecking);
            oscarsChecking.Deposit(100.0);
            oscar.OpenAccount(oscarsSavings);

            oscar.TransferFunds(oscarsChecking, oscarsSavings, 100);
            Assert.AreEqual(0, oscarsChecking.sumTransactions());
        }
Exemplo n.º 2
0
        public void CheckingAccount()
        {
            Bank bank = new Bank();
            //Account checkingAccount = new Account(Account.CHECKING);
            IAccount checkingAccount = new CheckingAccount();

            Customer bill = new Customer("Bill").OpenAccount(checkingAccount);
            bank.AddCustomer(bill);

            checkingAccount.Deposit(100.0);

            Assert.AreEqual(0.1, bank.totalInterestPaid(), DOUBLE_DELTA);
        }
Exemplo n.º 3
0
        public void TestApp()
        {
            IAccount checkingAccount = new CheckingAccount(); //Account(Account.CHECKING);
            IAccount savingsAccount = new SavingsAccount();//Account(Account.SAVINGS);

            Customer henry = new Customer("Henry").OpenAccount(checkingAccount).OpenAccount(savingsAccount);

            checkingAccount.Deposit(100.0);
            savingsAccount.Deposit(4000.0);
            savingsAccount.Withdraw(200.0);

            Assert.AreEqual("Statement for Henry\n" +
                    "\n" +
                    "Checking Account\n" +
                    "  deposit $100.00\n" +
                    "Total $100.00\n" +
                    "\n" +
                    "Savings Account\n" +
                    "  deposit $4,000.00\n" +
                    "  withdrawal $200.00\n" +
                    "Total $3,800.00\n" +
                    "\n" +
                    "Total In All Accounts $3,900.00", henry.GetStatement());
        }