public async Task GetPaymentsWithOutAnyExistingShouldHaveResponse()
        {
            MockPaymentsRepository.Setup(x => x.GetPaymentEntry(It.IsAny <Guid>())).ReturnsAsync(new GetPaymentEntryResult()
            {
                Success = true, PaymentEntry = null
            });
            var response = await this.Controller.GetPaymentDetails(new GetPaymentDetailsRequest()
            {
                PaymentIdentifier = Guid.NewGuid()
            }) as NotFoundResult;

            Assert.IsNotNull(response);
            Assert.AreEqual(404, response.StatusCode);
        }
        public async Task GetPaymentsWithExistingPaymentsShouldReturnData()
        {
            MockPaymentsRepository.Setup(x => x.GetPaymentEntry(It.IsAny <Guid>())).ReturnsAsync(new GetPaymentEntryResult()
            {
                Success = true, PaymentEntry = FakePaymentData.FakePaymentEntryData()
            });
            var response = await this.Controller.GetPaymentDetails(new GetPaymentDetailsRequest()
            {
                PaymentIdentifier = Guid.NewGuid()
            }) as OkObjectResult;

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Value);
        }
        public async Task CreatePaymentRequestShouldReturn201Response()
        {
            MockPaymentsRepository.Setup(x => x.ProcessPayment(It.IsAny <PaymentEntry>())).ReturnsAsync(new BaseResult()
            {
                Success = true, Message = "example message"
            });


            var response = await this.Controller.CreatePayment(FakeCreatePaymentData.FakeCreatePaymentRequest()) as CreatedAtActionResult;


            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Value);
            Assert.AreEqual(201, response.StatusCode);
        }
Beispiel #4
0
        public async Task CreatePaymentRequestShouldReturn201Response()
        {
            MockPaymentsRepository.Setup(x => x.AddPayment(It.IsAny <PaymentEntry>())).ReturnsAsync(new BaseResult()
            {
                Success = true, Message = "example message"
            });

            MockBankRepository.Setup(x => x.RequestPayment(It.IsAny <MockBankPaymentRequest>())).Returns(new MockBankResponse()
            {
                Identifier = Guid.NewGuid().ToString(), Status = CheckOut.PaymentGateway.Core.Enum.PaymentStatus.Authorized
            });

            var response = await this.Controller.CreatePayment(FakeCreatePaymentData.FakeCreatePaymentRequest()) as CreatedAtActionResult;


            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Value);
            Assert.AreEqual(201, response.StatusCode);
        }