Пример #1
0
        public async Task ShouldProcessPaymentWhenPartnerBankRespondsForAllStatuses(PaymentStatus paymentStatus)
        {
            var cardPayment       = new CardPaymentBuilder().Build();
            var successfulPayment = new PaymentResult()
            {
                PaymentStatus       = paymentStatus,
                Reference           = cardPayment.Reference,
                ThirdPartyReference = "12345"
            };

            _foobarBankClient.CreatePayment(cardPayment).Returns(successfulPayment);

            var result = await _cardPaymentService.CreateCardPayment(cardPayment);

            await _paymentsRepository.Received(1).CreatePaymentRequest(cardPayment);

            await _paymentsRepository.Received(1).UpdatePaymentResult(successfulPayment);

            Assert.Equal(successfulPayment, result, _paymentResultComparer);
        }