Ejemplo n.º 1
0
        public void CheckingAccount()
        {
            Bank            bank            = new Bank();
            AbstractAccount checkingAccount = new CHECKINGAccount();// Account(Account.CHECKING);
            Customer        bill            = new Customer("Bill").OpenAccount(checkingAccount);

            bank.AddCustomer(bill);

            checkingAccount.Deposit(100.0);

            Assert.AreEqual(0.1, bank.totalInterestPaid(), DOUBLE_DELTA);
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        public void TestApp()
        {
            AbstractAccount checkingAccount = new CHECKINGAccount(); // Account(Account.CHECKING);
            AbstractAccount 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());
        }