New view for new MStest scenaroio

This commit is contained in:
2019-11-19 23:23:47 +01:00
parent 03d8cf681e
commit d0847b19d2
5 changed files with 64 additions and 12 deletions

60
BrokerageLib/Account.cs Normal file
View File

@ -0,0 +1,60 @@
using System;
namespace BrokerageLib {
public class Account {
private string _customerName;
private decimal _balance;
private bool _frozen = false;
public Account(string customerName, decimal balance) {
_customerName = customerName;
_balance = balance;
}
public string CustomerName {
get { return _customerName; }
}
public decimal Balance {
get { return _balance; }
}
public void Debit(decimal amount) {
if (amount > _balance)
{
throw new ArgumentOutOfRangeException("amount");
}
if (amount < 0)
{
throw new ArgumentOutOfRangeException("amount");
}
_balance -= amount;
}
public void Credit(decimal amount) {
if (amount < 0)
{
throw new ArgumentOutOfRangeException("amount");
}
_balance += amount;
}
private void FreezeAccount() {
_frozen = true;
}
private void UnfreezeAccount() {
_frozen = false;
}
}
}