Beispiel #1
0
 public void TestDepositW6()
 {
     long accountNo = 123;
     double balance = 1000.00;
     double interestRate = 0.5;
     Account a = new Account(accountNo, balance, interestRate);
     a.Deposit(1000);
     double expected = 2000;
     double actual = a.Balance;
     Assert.AreEqual(expected, actual);
 }
Beispiel #2
0
 public void TestAddInterestRateW7()
 {
     long accountNo = 123;
     double balance = 1000.00;
     double interestRate = 0.05;
     Account a = new Account(accountNo, balance, interestRate);
     a.AddInterestRate();
     double expected = 1000.5;
     double actual = a.Balance;
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
 public void TestDepositW5()
 {
     long accountNo = 123;
     double balance = 1000.00;
     double interestRate = 0.5;
     Account a = new Account(accountNo, balance, interestRate);
     try
     {
         a.Deposit(0);
         Assert.Fail("Should throw an exception");
     }
     catch (InvalidAmountOrBalanceException)
     {
     }
 }
Beispiel #4
0
 public void TestSetInterestRateW8()
 {
     long accountNo = 123;
     double balance = 1000.00;
     double interestRate = -0.01;
     try
     {
         Account a = new Account(accountNo, balance, interestRate);
         Assert.Fail("Should throw an exception");
     }
     catch (InvalidInterestRate)
     {
     }
 }
Beispiel #5
0
 public void TestWithdrawW2()
 {
     long accountNo = 123;
     double balance = 1000.00;
     double interestRate = 0.5;
     Account a = new Account(accountNo, balance, interestRate);
     a.Withdraw(1000);
     double expected = 0;
     double actual = a.Balance;
     Assert.AreEqual(expected, actual);
 }
 //public void AddAccount(Customer customer, long accountNo, double balance, double interestRate)
 //{
 //    customer.Accounts.Add(new Account(accountNo, balance, interestRate));
 //    AccountNo = string.Empty;
 //    Balance = string.Empty;
 //    InterestRate = string.Empty;
 //}
 public void RemoveAccount(Customer customer, Account account)
 {
     customer.Accounts.Remove(account);
 }