public void CompletesValidWithdrawalTransaction() { var request = new WithdrawalCommandRequest() { CardNumber = "123", Amount = 100, Pin = "8888", }; var result = sut.Withdraw(request); Assert.IsTrue(result.IsSuccessful); }
public void FailsWithdrawalIfPinInvalid() { var request = new WithdrawalCommandRequest() { CardNumber = "123", Amount = 100, Pin = "7777", }; var result = sut.Withdraw(request); Assert.IsFalse(result.IsSuccessful); }
public void FailsWithdrawalICannotCompleteTransaction() { var request = new WithdrawalCommandRequest() { CardNumber = "123", Amount = 100, Pin = "8888", }; _accountBalanceManagerMock .Setup(abm => abm.ProcessTransaction(It.IsAny <AccountBalanceTransaction>())) .Throws(new Exception("Connection error")); var result = sut.Withdraw(request); Assert.IsFalse(result.IsSuccessful); }
public void FailsWithdrawalICannotReserveFunds() { var request = new WithdrawalCommandRequest() { CardNumber = "123", Amount = 100, Pin = "8888", }; _accountBalanceManagerMock .Setup(abm => abm.CheckAndReserveAmount(1, 100)) .Throws(new Exception("Connection error")); var result = sut.Withdraw(request); Assert.IsFalse(result.IsSuccessful); }
public void FailsWithdrawalIfInsufficientFunds() { var request = new WithdrawalCommandRequest() { CardNumber = "123", Amount = 100, Pin = "8888", }; _accountBalanceManagerMock .Setup(abm => abm.IsBalanceAvailable(1, 100)) .Returns(false); var result = sut.Withdraw(request); Assert.IsFalse(result.IsSuccessful); }