public async Task WhenAllConditionsAreMet_ShouldPerformWithdrawal() { Given.ValidAccountExistsInDatabase(FromAccount); And.UserIsAuthorisedToWithdraw(FromAccount, User); And.AccountHasEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount); await When.Withdraw(WithdrawalAmount, FromAccount, User); await Then.DidWithdrawalForAccount(FromAccount, WithdrawalAmount); }
public async Task AfterSuccessfulWithdrawal_ShouldCommitDatabaseTransaction() { Given.ValidAccountExistsInDatabase(FromAccount); And.ValidAccountExistsInDatabase(ToAccount); And.UserIsAuthorisedToWithdraw(FromAccount, User); And.AccountHasEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount); await When.TransferMoney(WithdrawalAmount, FromAccount, ToAccount, User); await Then.TransactionWasCommited(); }
public async Task WhenAllConditionsAreMet_ShouldPerformDeposit() { Given.ValidAccountExistsInDatabase(FromAccount); And.ValidAccountExistsInDatabase(ToAccount); And.UserIsAuthorisedToWithdraw(FromAccount, User); And.AccountHasEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount); await When.TransferMoney(WithdrawalAmount, FromAccount, ToAccount, User); await Then.DidDepositToAccount(ToAccount, WithdrawalAmount); }
public async Task SuccessfulWithdrawal_ShouldReturnTrue() { Given.ValidAccountExistsInDatabase(FromAccount); And.UserIsAuthorisedToWithdraw(FromAccount, User); And.AccountHasEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount); // When var transactionResult = await SUT.Withdraw(WithdrawalAmount, FromAccount, User); // Then transactionResult.Should().BeTrue(); }
public async Task AfterSuccessfulWithdrawal_ShouldCommitDatabaseTransaction() { Given.ValidAccountExistsInDatabase(FromAccount); And.UserIsAuthorisedToWithdraw(FromAccount, User); And.AccountHasEnoughFundsForWithdrawal(FromAccount, WithdrawalAmount); await When.Withdraw(WithdrawalAmount, FromAccount, User); await Then.TransactionWasCommited(); // or // await Mock<IAccountRepository>().Received().CommitTransaction(Arg.Any<int>()); }