本文介绍了ExecuteMultipleResponse Dynamic CRM单元测试错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前,我正在尝试使用假的XRM Easy为Dynamics CRM应用程序编写测试。此代码给我一个错误。
var executeMultiple = new ExecuteMultipleRequest
{
Settings = new ExecuteMultipleSettings
{
ContinueOnError = true,
ReturnResponses = true
},
Requests = new OrganizationRequestCollection()
};
executeMultiple.Requests.AddRange(this.requestBag.Select(x => x.request));
try
{
var batchResponse = (ExecuteMultipleResponse)this.orgService.Execute(executeMultiple);
foreach (var response in batchResponse.Responses)
{
this.requestsPerformedByServiceCounter++;
this.OnResponseReceived(new ResponseReceivedEventArgs
{
Fault = response.Fault,
RequestIndex = response.RequestIndex,
Response = response.Response,
Request = this.requestBag[response.RequestIndex].request,
Identifier = this.requestBag[response.RequestIndex].identifier,
TotalRequestsPerformed = this.requestsPerformedByServiceCounter,
});
}
this.requestBag.Clear();
此方法正在调用上层方法
foreach (var company in this.companies)
{
EntityReference existedAccountRef = null;
if (!string.IsNullOrEmpty(company.id.ToString()))
{
var existedAccount = this.crmService.IsCompanyExistInCrm(company.id);
existedAccountRef = existedAccount != null ? existedAccount.ToEntityReference() : null;
}
if (existedAccountRef != null)
{
bulkExecutionService.Update(new Account()
{
AccountId = existedAccountRef.Id,
Name = company.name,
odx_Bank_Account_Number = company.bank_account_number,
// odx_Company_share_Capital = company.company_share_capital, todo
odx_Is_Foreign = company.is_foreign,
odx_KRS = company.krs,
odx_Legal_form = company.legal_form,
odx_NIP = company.nip,
odx_Paynow_Created_at = company.created_at,
odx_Paynow_Modified_at = company.modified_at,
odx_PaynowID = company.id,
odx_pkd = company.pkd,
odx_regon = company.regon,
odx_Vat_EU = company.vat_eu
}, company.id);
}
else
{
bulkExecutionService.Create(new Account()
{
Name = company.name,
odx_Bank_Account_Number = company.bank_account_number,
// odx_Company_share_Capital = company.company_share_capital, todo
odx_Is_Foreign = company.is_foreign,
odx_KRS = company.krs,
odx_Legal_form = company.legal_form,
odx_NIP = company.nip,
odx_Paynow_Created_at = company.created_at,
odx_Paynow_Modified_at = company.modified_at,
odx_PaynowID = company.id,
odx_pkd = company.pkd,
odx_regon = company.regon,
odx_Vat_EU = company.vat_eu
}, company.id);
}
}
bulkExecutionService.FinalizeExecutor();
我收到的错误在该行中:
var batchResponse = (ExecuteMultipleResponse)this.orgService.Execute(executeMultiple);
FakeXrmEasy.Abstractions.Exceptions.PullRequestException:‘异常:尚不支持组织请求类型’Microsoft.Xrm.Sdk.Messages.ExecuteMultipleRequest‘...
老实说,我不知道我能用它做些什么。
推荐答案
您是否尝试安装FakeXrmEasy.Messages包?
FakeXrmEasy v2或更高版本现在使用模块化体系结构。
创建、检索、更新、删除、升级、关联或讨论消息位于FakeXrmEasy.Core包中,但其他消息现在位于专用FakeXrmEasy.Messages包中。
这是covered in the Installing section of the docs site
这篇关于ExecuteMultipleResponse Dynamic CRM单元测试错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!