public void MockupdateCustomerProfileTest() { //define all mocked objects as final var mockController = GetMockController<updateCustomerProfileRequest, updateCustomerProfileResponse>(); var mockRequest = new updateCustomerProfileRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var mockResponse = new updateCustomerProfileResponse { refId = "1234", sessionToken = "sessiontoken", }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<updateCustomerProfileRequest, updateCustomerProfileResponse, updateCustomerProfileController>( 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); }
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId) { Console.WriteLine("Update customer profile sample"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; // define the merchant information (authentication / transaction id) ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() { name = ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ApiTransactionKey, }; var profile = new customerProfileExType { merchantCustomerId = "custId123", description = "some description", email = "*****@*****.**", customerProfileId = customerProfileId }; var request = new updateCustomerProfileRequest(); request.profile = profile; // instantiate the controller that will call the service var controller = new updateCustomerProfileController(request); controller.Execute(); // get the response from the service (errors contained if any) var response = controller.GetApiResponse(); if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { Console.WriteLine(response.messages.message[0].text); } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }
public static void updateCustomerProfileRequest(updateCustomerProfileRequest argument) { if (null != argument) { customerProfileExType(argument.profile); } }
public static void updateCustomerProfileRequest ( updateCustomerProfileRequest request) { }