コード例 #1
0
        public async Task GivenAPaymentId_WhenPaymentIsFound_ThenReturnPaymentStatus()
        {
            var payment = TestPayment.ValidPayment(_paymentId);

            SetupPaymentStoreResponse(_paymentId, payment);

            var response = await GetAsync(_paymentId);

            var paymentResponse = await ReadAsAsync <PaymentResponse>(response);

            paymentResponse.Status.Should().Be(payment.Status);
        }
コード例 #2
0
        public async Task GivenAPaymentId_WhenPaymentIsFound_ThenReturnMaskedPayment()
        {
            var payment = TestPayment.ValidPayment(_paymentId);

            SetupPaymentStoreResponse(_paymentId, payment);

            var response = await GetAsync(_paymentId);

            var paymentResponse = await ReadAsAsync <PaymentResponse>(response);

            paymentResponse.CardNumber.Should().NotBe(payment.CardNumber);
            paymentResponse.CardNumber.Should().Be(payment.MaskedCardNumber);
        }
コード例 #3
0
        public async Task GivenAPaymentId_WhenPaymentIsFound_ThenReturnPayment()
        {
            var payment = TestPayment.ValidPayment(_paymentId);

            SetupPaymentStoreResponse(_paymentId, payment);

            var response = await GetAsync(_paymentId);

            var paymentResponse = await ReadAsAsync <PaymentResponse>(response);

            paymentResponse.Id.Should().Be(_paymentId);
            paymentResponse.ExpiryMonth.Should().Be(payment.ExpiryMonth);
            paymentResponse.ExpiryYear.Should().Be(paymentResponse.ExpiryYear);
            paymentResponse.Currency.Should().Be(paymentResponse.Currency);
            paymentResponse.Amount.Should().Be(paymentResponse.Amount);
        }
コード例 #4
0
 private void SetupPaymentStoreResponse(Guid paymentId, Payment payment = null)
 {
     _paymentStore
     .Setup(o => o.Get($"{MerchantId}{paymentId}"))
     .Returns(payment ?? TestPayment.ValidPayment(paymentId));
 }