public void MockgetCustomerShippingAddressTest() { //define all mocked objects as final var mockController = GetMockController<getCustomerShippingAddressRequest, getCustomerShippingAddressResponse>(); var mockRequest = new getCustomerShippingAddressRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var customerAddressExType = new customerAddressExType { customerAddressId = "1234", }; var mockResponse = new getCustomerShippingAddressResponse { refId = "1234", sessionToken = "sessiontoken", address = customerAddressExType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getCustomerShippingAddressRequest, getCustomerShippingAddressResponse, getCustomerShippingAddressController>( 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.address); LogHelper.info(Logger, "getCustomerShippingAddress: Details:{0}", controllerResponse.address); }
public static void getCustomerShippingAddressResponse(getCustomerShippingAddressResponse argument) { if (null != argument) { customerAddressExType(argument.address); } }