public async Task ProcessPayment_ValidRequest_ReturnsOkResultWithIdAndSuccess() { var request = new PaymentRequest { CardNumber = "1234567892", ExpireDateYear = 2021, ExpireDateMonth = 10, CVV = "123", Amount = (decimal)10.10, Currency = "EUR" }; var paymentId = Guid.NewGuid(); _paymentServiceMock.Setup(x => x.ProcessPayment(It.IsAny <ProcessPaymentRequest>())) .Returns(Task.FromResult(new ProcessPaymentResponse { PaymentStatus = PaymentStatus.Processed, PaymentId = paymentId })); var response = await _paymentGatewayController.ProcessPayment(request); Assert.IsInstanceOf <OkObjectResult>(response.Result); var okObjectResult = (OkObjectResult)response.Result; Assert.IsInstanceOf <PaymentResponse>(okObjectResult.Value); var paymentResponse = (PaymentResponse)okObjectResult.Value; Assert.IsTrue(paymentResponse.IsSuccess); Assert.AreEqual(paymentId, paymentResponse.PaymentId); }