Expanded Unit Tests
This commit is contained in:
@@ -8,20 +8,29 @@ namespace Week_10___Account_Library
|
||||
{
|
||||
public class Account
|
||||
{
|
||||
|
||||
private decimal _balance;
|
||||
private decimal _overdraftLimit;
|
||||
|
||||
public decimal Balance => _balance;
|
||||
public decimal OverdraftLimit => _overdraftLimit;
|
||||
public AccountState StateOfAccount { get; }
|
||||
|
||||
void Deposit(decimal amount)
|
||||
private bool ValidateAmount(decimal amount)
|
||||
{
|
||||
_balance += amount;
|
||||
return amount >= 0;
|
||||
}
|
||||
|
||||
void Withdraw(decimal amount)
|
||||
public void Deposit(decimal amount)
|
||||
{
|
||||
_balance -= amount;
|
||||
if (ValidateAmount(amount))
|
||||
_balance += amount;
|
||||
}
|
||||
|
||||
public void Withdraw(decimal amount)
|
||||
{
|
||||
if (ValidateAmount(amount))
|
||||
_balance -= amount;
|
||||
}
|
||||
|
||||
public Account(decimal balance, decimal overdraftLimit)
|
||||
@@ -30,4 +39,12 @@ namespace Week_10___Account_Library
|
||||
_overdraftLimit = overdraftLimit;
|
||||
}
|
||||
}
|
||||
|
||||
public enum AccountState
|
||||
{
|
||||
Safe,
|
||||
InOD,
|
||||
ODLimit,
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user