public void MockgetUnsettledTransactionListTest()
	    {
		    //define all mocked objects as final
            var mockController = GetMockController<getUnsettledTransactionListRequest, getUnsettledTransactionListResponse>();
            var mockRequest = new getUnsettledTransactionListRequest
                {
                    merchantAuthentication = new merchantAuthenticationType {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey},
                };
            var transactionSummaryType = new transactionSummaryType[]
                {
                    new transactionSummaryType
                        {
                            accountNumber = "1234",
                        }
                };
            var mockResponse = new getUnsettledTransactionListResponse
                {
                    refId = "1234",
                    sessionToken = "sessiontoken",
                    transactions = transactionSummaryType,
                };

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

            SetMockControllerExpectations<getUnsettledTransactionListRequest, getUnsettledTransactionListResponse, getUnsettledTransactionListController>(
                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, "getUnsettledTransactionList: Details:{0}", controllerResponse.transactions);
	    }
コード例 #2
0
 public static void getUnsettledTransactionListResponse(getUnsettledTransactionListResponse argument)
 {
     if (null != argument)
     {
         if (null != argument.transactions) { foreach (var value in argument.transactions) { transactionSummaryType(value); } }
     }
 }