public void MockcreateCustomerProfileTransactionTest()
        {
            //define all mocked objects as final
            var mockController = GetMockController <createCustomerProfileTransactionRequest, createCustomerProfileTransactionResponse>();
            var mockRequest    = new createCustomerProfileTransactionRequest
            {
                merchantAuthentication = new merchantAuthenticationType {
                    name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey
                },
                transaction = new profileTransactionType
                {
                    Item = new profileTransAuthCaptureType(),
                },
            };
            var transactionResponse = new transactionResponse()
            {
                accountNumber = "1234",
            };
            var mockResponse = new createCustomerProfileTransactionResponse
            {
                refId               = "1234",
                sessionToken        = "sessiontoken",
                transactionResponse = transactionResponse,
            };

            var errorResponse = new ANetApiResponse();
            var results       = new List <String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations <createCustomerProfileTransactionRequest, createCustomerProfileTransactionResponse, createCustomerProfileTransactionController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();

            Assert.IsNotNull(controllerResponse);

            Assert.IsNotNull(controllerResponse.transactionResponse);
            LogHelper.info(Logger, "createCustomerProfileTransaction: Details:{0}", controllerResponse.transactionResponse);
        }
Ejemplo n.º 2
0
 public PaymentResponse()
 {
     transactionResponse = new transactionResponse();
 }