public void CheckingAccountTest_SumTransactions()
        {
            IAccount checkingAccount = new CheckingAccount();

            checkingAccount.Deposit(450.75m);
            checkingAccount.Deposit(120.32m);
            checkingAccount.Withdraw(4.67m);

            Assert.AreEqual(566.40m, checkingAccount.SumTransactions());
        }
        public void CheckingAccountTest_InterestEarned_More_Than_A_Thousand()
        {
            IAccount checkingAccount = new CheckingAccount();

            checkingAccount.Deposit(950.75m);
            checkingAccount.Deposit(1520.32m);
            checkingAccount.Withdraw(95.00m);

            Assert.AreEqual(2.37607m, checkingAccount.InterestEarned());
        }
        public void CheckingAccountTest_InterestEarned_Less_Than_A_Thousand()
        {
            IAccount checkingAccount = new CheckingAccount();

            checkingAccount.Deposit(450.75m);
            checkingAccount.Deposit(120.32m);
            checkingAccount.Withdraw(4.67m);

            Assert.AreEqual(.5664m, checkingAccount.InterestEarned());
        }
Exemple #4
0
        public void TestApp()
        {
            CheckingAccount checkingAccount = new CheckingAccount();
            SavingsAccount savingsAccount = new SavingsAccount();

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

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

            var actual = henry.GetStatement();
            var expected = "Statement for HENRY" + Environment.NewLine +
                    Environment.NewLine +
                    "Checking Account" + Environment.NewLine +
                    "  deposit $100.00" + Environment.NewLine +
                    "Total $100.00" + Environment.NewLine +
                    Environment.NewLine +
                    "Savings Account" + Environment.NewLine +
                    "  deposit $4,000.00" + Environment.NewLine +
                    "  withdrawal $200.00" + Environment.NewLine +
                    "Total $3,800.00" + Environment.NewLine +
                    Environment.NewLine +
                    "Total In All Accounts: $3,900.00";

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void CheckingAccount()
        {
            Bank bank = new Bank();
            CheckingAccount checkingAccount = new CheckingAccount();
            Customer bill = new Customer("Bill").OpenAccount(checkingAccount);
            bank.AddCustomer(bill);

            checkingAccount.Deposit(100.0m);

            Assert.AreEqual(0.1m, bank.totalInterestPaid());
        }
        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());
        }
Exemple #7
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);
        }
Exemple #8
0
        public void AccountTest_Withdraw_More_Than_Account_Balance()
        {
            IAccount account = new CheckingAccount();
            account.Deposit(100);

            try
            {
                account.Withdraw(150);
            }
            catch (ArgumentException ae)
            {
                Assert.AreEqual(ae.Message, "cannot withdraw more than current account balance");
                return;
            }

            Assert.Fail("No exception was thrown");
        }
        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());
        }