public void TestTwoAccount()
 {
     Customer oscar = new Customer("Oscar")
          .OpenAccount(new Account(Account.SAVINGS));
     oscar.OpenAccount(new Account(Account.CHECKING));
     Assert.AreEqual(2, oscar.GetNumberOfAccounts());
 }
 public void TestTwoAccount()
 {
     Customer oscar = new Customer("Oscar")
          .OpenAccount(new SavingsAccount());
     oscar.OpenAccount(new CheckingAccount());
     Assert.AreEqual(2, oscar.GetNumberOfAccounts());
 }
        public void CustomerSummary() 
        {
            Bank bank = new Bank();
            Customer john = new Customer("John");
            john.OpenAccount(new Account(Account.CHECKING));
            bank.AddCustomer(john);

            Assert.AreEqual("Customer Summary\n - John (1 account)", bank.CustomerSummary());
        }
 public void TestMoneyTransfer()
 {
     Account maxiAccount = new Account(Account.MAXI_SAVINGS);
     Customer oscar = new Customer("Oscar").OpenAccount(savingsAccount);
     oscar.OpenAccount(maxiAccount);
     savingsAccount.Deposit(1500.0);
     maxiAccount.Deposit(3000.0);
     Assert.AreEqual(oscar, oscar.IntraAccountTransfer(maxiAccount, savingsAccount, 500));
 }
        public void CheckingAccount() {
            Bank bank = new Bank();
            Account checkingAccount = new 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);
        }
        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 CustomerSummary() 
        {
           // Bank bank = new Bank();
            Customer john = new Customer("John");
            john.OpenAccount(new Account(Account.CHECKING));
            bank.AddCustomer(john);

            Customer mike = new Customer("Mike");
            mike.OpenAccount(new Account(Account.SAVINGS));
            bank.AddCustomer(mike);

            Assert.AreEqual("Customer Summary\n - John (1 account)\n - Mike (1 account)", bank.CustomerSummary());
        }
Exemple #8
0
        public void TotalInterestPaid() {
            //Bank bank = new Bank();
            Account checkingAccount = new Account(Account.CHECKING);
            Customer bill = new Customer("Bill").OpenAccount(checkingAccount);
            bank.AddCustomer(bill);

            checkingAccount.Deposit(100.0);
           
            Account savingsAccount = new Account(Account.SAVINGS);
            savingsAccount.Deposit(1500.0);
            bill.OpenAccount(savingsAccount);

            Assert.AreEqual(2.1, bank.totalInterestPaid(), DOUBLE_DELTA);
        }
        public void TestTransferMoney()
        {
            Customer oscar = new Customer("Oscar");
            Account savings = new Account(Account.SAVINGS);
            Account checkings =new Account(Account.CHECKING);
            oscar.OpenAccount(savings);
            oscar.OpenAccount(checkings);

            savings.Deposit(4000);
            checkings.Deposit(500);

            oscar.transfer(checkings, savings, 500);
            
            Assert.AreEqual(3500, savings.getBalance());
            Assert.AreEqual(1000, checkings.getBalance());
        }
        public Customer Account_To_Account_Transfer(Customer customer, IAccount fromAccnt, IAccount toAccnt, double amount)
        {
            //check priviledges based on customer object
            // customer.Accounts.
            if (amount <= 0)
                throw new ArgumentException("Amount must be more than zero");
            if (fromAccnt.sumTransactions() < amount)
                throw new Exception("Not enough funds in source account");

            try
            {
                fromAccnt.Withdraw(amount);
                toAccnt.Deposit(amount);
            }
            catch (Exception ex)
            {
                throw new Exception("Error: Unable to Transfer", ex);
            }

            return customer;
        }
        public void TestApp()
        {
            Account checkingAccount = new Account(Account.CHECKING);
            Account savingsAccount = new 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());
        }
 public void TestOneAccount()
 {
     Customer oscar = new Customer("Oscar").OpenAccount(new Account(Account.SAVINGS));
     Assert.AreEqual(1, oscar.GetNumberOfAccounts());
 }
Exemple #13
0
 public void AddCustomer(Customer customer)
 {
     customers.Add(customer);
 }
 public void TestCustomerNameWithSpace()
 {
     var bill = new Customer(" ");
 }
 public void AddCustomer(Customer customer)
 {
     customers.Add(customer);
 }