public async Task AddPaymentAsync_RunsOk()
        {
            //Arrange
            var paymentToCreate = new Payment
            {
                FullName          = CreatedFullName,
                Amount            = 100,
                Currency          = "EUR",
                CardNumber        = "encrypted-card-number",
                Expiry            = "08/22",
                BankPaymentId     = Guid.NewGuid().ToString(),
                BankPaymentStatus = "success"
            };

            //Act
            var result = await PaymentRepository.AddAsync(paymentToCreate);

            _id = result.Id;

            //Assert
            Assert.NotNull(result);
            Assert.NotEqual(Guid.Empty, _id);
            Assert.Equal(CreatedFullName, result.FullName);
            Assert.Equal(paymentToCreate.Amount, result.Amount);
            Assert.Equal(paymentToCreate.Currency, result.Currency);
            Assert.Equal(paymentToCreate.CardNumber, result.CardNumber);
            Assert.Equal(paymentToCreate.Expiry, result.Expiry);
            Assert.Equal(paymentToCreate.BankPaymentId, result.BankPaymentId);
            Assert.Equal(paymentToCreate.BankPaymentStatus, result.BankPaymentStatus);
            Assert.False(result.CreatedAt == DateTime.MinValue);
        }
示例#2
0
            public Payment SetupAddPayment(CreateNewPayment newPaymentData)
            {
                var expectedPayment = new Payment();

                A.CallTo(() => PaymentRepository.AddAsync(A <Payment> .That.Matches((passedPayment) =>
                                                                                    passedPayment.Amount == newPaymentData.Amount &&
                                                                                    passedPayment.PayerId == newPaymentData.PayerId &&
                                                                                    passedPayment.ReceiverId == newPaymentData.ReceiverId &&
                                                                                    passedPayment.GroupContextId == newPaymentData.GroupContextId
                                                                                    ))).Returns(expectedPayment);

                return(expectedPayment);
            }