コード例 #1
0
            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);
            }
コード例 #2
0
            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();
            }
コード例 #3
0
            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);
            }
コード例 #4
0
            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();
            }
コード例 #5
0
            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>());
            }