public void MockgetTransactionListTest() { //define all mocked objects as final var mockController = GetMockController<getTransactionListRequest, getTransactionListResponse>(); var mockRequest = new getTransactionListRequest { merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey}, }; var transactionSummaryType = new transactionSummaryType[] { new transactionSummaryType { accountNumber = "1234", } }; var mockResponse = new getTransactionListResponse { refId = "1234", sessionToken = "sessiontoken", transactions = transactionSummaryType, }; var errorResponse = new ANetApiResponse(); var results = new List<String>(); const messageTypeEnum messageTypeOk = messageTypeEnum.Ok; SetMockControllerExpectations<getTransactionListRequest, getTransactionListResponse, getTransactionListController>( 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.transactions); LogHelper.info(Logger, "getTransactionList: Details:{0}", controllerResponse.transactions); }
public static void getTransactionListResponse(getTransactionListResponse argument) { if (null != argument) { if (null != argument.transactions) { foreach (var value in argument.transactions) { transactionSummaryType(value); } } } }