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