Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

CloseIncidentRequest throwing error #516

Open
richardhardinguk opened this issue Aug 3, 2020 · 1 comment · May be fixed by #522
Open

CloseIncidentRequest throwing error #516

richardhardinguk opened this issue Aug 3, 2020 · 1 comment · May be fixed by #522

Comments

@richardhardinguk
Copy link

richardhardinguk commented Aug 3, 2020

Running code containing CloseIncidentRequest throws the following error:

FakeXrmEasy.PullRequestException: 'Exception: The organization request type 'Microsoft.Crm.Sdk.Messages.CloseIncidentRequest' is not yet supported... but we DO love pull requests so please feel free to submit one! :). This functionality is not available yet.

However, as per link https://github.com/jordimontana82/fake-xrm-easy/blob/5531248d7e9dc2a112b17735e0bf5939e974d342/FakeXrmEasy.Tests.Shared/FakeContextTests/CloseIncidentRequestTests/CloseIncidentRequestTests.cs , it looks as though this is included and supposed to be supported?

Code being run is:
`
// Close the case
var incidentResolution = new IncidentResolution
{
Subject = "Cyclical Schedule Completed",
};
incidentResolution.IncidentId = insp.ebecs_incidentid;

            CloseIncidentRequest closeRequest = new CloseIncidentRequest
            {
                IncidentResolution = incidentResolution,
                Status = new OptionSetValue((int)Incident_StatusCode.PracticallyComplete),
            };
            service.Execute(closeRequest);`

Assemblies have been updated today to 1.57.1

@codes4pizza
Copy link

We just had this same issue in some of our unit tests which were using ExecuteMultipleRequest. We tracked the problem down to a bug in FakeXrmEasy.Shared\FakeMessageExecutors\CloseIncidentRequestExecutor.cs on line 73 where it is returning the type of CloseIncidentResponse but it should be returning the type of the CloseIncidentRequest.

There is a workaround by creating a copy of the CloseIncidentRequestExecutor.cs in your test project, changing the name of the class to avoid clashes and then use the code below at the start of your unit test. Also remembering to fix the bug on line 73 of your workaround class.

var ctx = new XrmFakedContext();
ctx.AddFakeMessageExecutor<CloseIncidentRequest>(new WorkaroundCloseIncidentRequestExecutor());

The above resolved it for us for now until the problem is fixed. If one of the team gets some time we will create a pull request.

@mirko-speranza mirko-speranza linked a pull request Oct 3, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants