Пример #1
0
        public void Should_get_debtor_account_by_its_account_number_using_configured_account_store()
        {
            config.DataStoreType.Returns(DataStoreType.BackupAccount);
            var request = new MakePaymentRequest
            {
                DebtorAccountNumber = "12312312ABC",
                PaymentScheme       = PaymentScheme.Bacs
            };
            var paymentService = CreateService();

            paymentService.MakePayment(request);

            backupAccountDataStore.Received(1)
            .GetAccount(request.DebtorAccountNumber);
        }
Пример #2
0
        public void Should_persist_account_with_updated_balance_if_validation_is_successful()
        {
            const string accountNumber = "12312312ABC";
            var          request       = new MakePaymentRequest
            {
                PaymentScheme       = PaymentScheme.Bacs,
                DebtorAccountNumber = accountNumber,
                Amount = 122
            };
            var account = accountBuilder
                          .WithAccountNumberAs(accountNumber)
                          .WithBalanceAs(224)
                          .Build();

            config.DataStoreType.Returns(DataStoreType.Account);
            accountDataStore.GetAccount(Arg.Any <string>()).Returns(account);
            bacsValidator.Validate(Arg.Any <Account>(), Arg.Any <MakePaymentRequest>())
            .Returns(MakePaymentResult.Ok);
            var paymentService = CreateService();

            paymentService.MakePayment(request);

            accountDataStore.Received(1).UpdateAccount(account);
        }