public void AccountCreditOrWithdraw_WithdrawMoreThanTotalAccountBalance_ReturnsFalse() { //Arrange bool expected = false; AccountDL accountDL = new AccountDL(); //Act bool actual = accountDL.AccountCreditOrWithdraw(10000000113, 213123); //Assert Assert.AreEqual(expected, actual); }
public void AccountCreditOrWithdraw_WithdrawLessThanTotalAccountBalance_ReturnsTrue() { //Arrange bool expected = true; AccountDL accountDL = new AccountDL(); //Act bool actual = accountDL.AccountCreditOrWithdraw(10000000061, 0); //Assert Assert.AreEqual(expected, actual); }
private void submit_Click(object sender, EventArgs e) { double amount; var account = accountDL.GetAccountDetail(Int64.Parse(AccountSearch.Text)); if (!double.TryParse(balance.Text, out amount)) { MessageBox.Show("Invalid Arguements"); this.Close(); } else { if (transactionTypeBox.SelectedIndex == 0) { if (account.AccountType == 1) { accountDL.AccountCreditOrWithdraw(account.AccountId, amount); MessageBox.Show("Account Credited Successfully"); } else if (account.AccountType == 2) { if (account.TotalBalance + amount > 5000) { MessageBox.Show("Exceeding Bank Limit"); } else { accountDL.AccountCreditOrWithdraw(account.AccountId, amount); MessageBox.Show("Account Credited Successfully"); } } else { if (account.TotalBalance - amount >= 0) { accountDL.Repay(account.AccountId, amount); MessageBox.Show("Loan Repayed!!"); } else { MessageBox.Show("Exceeding Bank Limit"); } } } else if (branchDL.GetBranchTotalBalance(account.BranchId) - amount >= 0) { if (account.AccountType == 3) { accountDL.Issue(account.AccountId, amount); MessageBox.Show("Loan Issued!!!"); } else if (account.TotalBalance - amount >= 0) { accountDL.AccountCreditOrWithdraw(account.AccountId, -amount); MessageBox.Show("Withdrawn Complete!!!"); } else { MessageBox.Show("Insufficient Balance In Account!!!"); } } else { MessageBox.Show("Insufficient Balance In Branch!!!"); } } this.Close(); }