-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAccountTest.cs
47 lines (41 loc) · 1.08 KB
/
AccountTest.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
using System;
using NUnit.Framework;
[TestFixture]
public class Tester
{
private double epsilon = 1e-6;
[Test]
public void AccountCannotHaveNegativeOverdraftLimit()
{
Account account = new Account(-20);
Assert.AreEqual(0, account.OverdraftLimit, epsilon);
}
[Test]
public void NoNegativeNumbers()
{
Account account = new Account(20);
Assert.AreEqual(false, account.Deposit(-20));
Assert.AreEqual(false, account.Withdraw(-20));
}
[Test]
public void DepositWithdrawWorks()
{
Account account = new Account(20);
Assert.AreEqual(true, account.Deposit(20));
Assert.AreEqual(true, account.Withdraw(20));
}
[Test]
public void CorrectAmount()
{
Account account = new Account(20);
account.Deposit(20);
account.Withdraw(10);
Assert.AreEqual(10, account.Balance, epsilon);
}
[Test]
public void AccountOverdraft()
{
Account account = new Account(30);
Assert.AreEqual(false, account.Withdraw(40));
}
}