/
BankTest.cs
60 lines (46 loc) · 1.67 KB
/
BankTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using NUnit.Framework;
namespace AbcBankTest
{
[TestFixture]
public class BankTest
{
private static readonly double DOUBLE_DELTA = 1e-15;
[Test]
public void customerSummary()
{
Bank bank = new Bank();
Customer Bob = new Customer("Bob");
Bob.openAccount(new Account(Account.CHECKING));
bank.addCustomer(Bob);
Assert.AreEqual("Customer Summary\n - Bob (1 account)", bank.customerSummary());
}
[Test]
public void checkingAccount()
{
Bank bank = new Bank();
Account checkingAccount = new Account(Account.CHECKING);
Customer Steve = new Customer("Steve").openAccount(checkingAccount);
bank.addCustomer(Steve);
checkingAccount.deposit(100.0);
Assert.AreEqual(0.1, bank.totalInterestPaid(), DOUBLE_DELTA);
}
[Test]
public void savings_account()
{
Bank bank = new Bank();
Account checkingAccount = new Account(Account.SAVINGS);
bank.addCustomer(new Customer("Steve").openAccount(checkingAccount));
checkingAccount.deposit(1500.0);
Assert.AreEqual(2.0, bank.totalInterestPaid(), DOUBLE_DELTA);
}
[Test]
public void maxi_savings_account()
{
Bank bank = new Bank();
Account checkingAccount = new Account(Account.MAXI_SAVINGS);
bank.addCustomer(new Customer("Steve").openAccount(checkingAccount));
checkingAccount.deposit(3000.0);
Assert.AreEqual(170.0, bank.totalInterestPaid(), DOUBLE_DELTA);
}
}
}