public void GivenExistingAccount_WhenDepositMoneyToAccount_ThenAccountBalanceShouldBeEqualMoneyDeposited() { //arrange int accountId = 1; var account = new CustomerAccount(accountId); int moneyToDeposit = 100; //act account.Deposit(moneyToDeposit); //assert Assert.AreEqual(account.Balance, moneyToDeposit); }
public void GivenExistingAccount_WhenWithdrawMoreMoneyFromAccountThenBalance_ThenAccountBalanceExceptionIsGeneratedWithPredefinedMessage() { //arrange int accountId = 1; var account = new CustomerAccount(accountId); int moneyToWithdraw = 100; account.Deposit(30); //act AccountBalanceException ex = Assert.Throws <AccountBalanceException>(() => account.Withdraw(moneyToWithdraw)); //assert Assert.That(ex.Message, Is.EqualTo("Not enough money on account!")); }
public void GivenExistingAccount_WhenWithdrawMoneyFromAccount_ThenAccountBalanceShouldChangeAccordingly() { //arrange int accountId = 1; var account = new CustomerAccount(accountId); int moneyToWithdraw = 100; account.Deposit(moneyToWithdraw); //act decimal accountPreviousBalance = account.Balance; account.Withdraw(moneyToWithdraw); //assert Assert.AreEqual(moneyToWithdraw, accountPreviousBalance - account.Balance); }
public void GivenExistingAccount_WhenWithdrawMoreMoneyFromAccountThenBalance_ThenAccountBalanceStayTheSame() { //arrange int accountId = 1; var account = new CustomerAccount(accountId); int moneyToWithdraw = 100; account.Deposit(30); decimal accountPreviousBalace = account.Balance; //act Assert.Throws <AccountBalanceException>(() => account.Withdraw(moneyToWithdraw)); //assert Assert.That(account.Balance, Is.EqualTo(accountPreviousBalace)); }
public bool AccountDeposit(double amount) { return(CustomerAccount.Deposit(amount)); }