首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ExecuteMultipleResponse动力客户关系管理单元测试错误

ExecuteMultipleResponse动力客户关系管理单元测试错误
EN

Stack Overflow用户
提问于 2022-01-26 11:23:23
回答 1查看 177关注 0票数 0

目前,我正试图编写测试动态CRM应用程序使用假XRM容易。这段代码给了我一个错误。

代码语言:javascript
复制
          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();

此方法正在调用上级方法。

代码语言:javascript
复制
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();

我所遇到的错误就在这一行:

代码语言:javascript
复制
var batchResponse = (ExecuteMultipleResponse)this.orgService.Execute(executeMultiple);

FakeXrmEasy.Abstractions.Exceptions.PullRequestException:的例外:还不支持组织请求类型'Microsoft.Xrm.Sdk.Messages.ExecuteMultipleRequest‘.

老实说,我不知道我能用它做什么。

EN

回答 1

Stack Overflow用户

发布于 2022-01-27 21:41:57

你试过安装FakeXrmEasy.Messages软件包了吗?

FakeXrmEasy v2或更高版本现在使用模块化架构。

创建、检索、更新、删除、向上插入、关联消息或Dissasociate消息位于FakeXrmEasy.Core包中,但其他消息现在位于该专用FakeXrmEasy.Messages包中。

我是包含在docs站点的安装部分中。

编辑:安装消息包后,还请添加对中间件设置中的假消息执行器之一的引用,如下所示:

代码语言:javascript
复制
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(AddListMembersListRequestExecutor)))

这将使用反射查找任何其他虚假消息。如果您在自己的程序集中有自己的消息,可以任意多次调用该方法。这是可能的,因为2.1.x和3.1.x版本。

请查看这里的发布说明:

https://dynamicsvalue.github.io/fake-xrm-easy-docs/releases/2x/2.1.1/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70862663

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档