fake-xrm-easy
fake-xrm-easy copied to clipboard
Execute Plugin Steps
Is it possible to register plugin steps and have them execute on the creation of records?
eg, create contact and have the fake CRM call any pre / post steps during the update.
Thanks
Hi Steve,
Nope, at the minute. The intention was to unit tests plugins independently from each other, but not to do something like , .Update(contact) and then also run the pre / post plugins registered for the Update message.
But, you can inject the output parameters from one plugin into another one via the context. What are you trying to achieve / what's your vision?
Thanks for the reply.
We have the od integration test that should really be unit tests with a mocked up CRM, some of these expect data in fields to be populated by plugins.
-- ps
typing with a broken hand so apologies for being brief.
Hi @SteveDrakey, Does my PR solve your question?
Hi @SteveDrakey ,
This issue has been open for a while.... does the new UsePipelineSimulation introduced by @eNeRGy164 solve your question now?
Not sure if this is the right place to ask this question. I have been trying out UsePipelineSimulation, however some of our existing code expects OrganizationName to be not null on the IExecutionContext. When using ExecutePluginWith, we can specify properties on the XrmFakedPluginExecutionContext, but it doesn't seem possible when using UsePipelineSimulation. Is there anyway of setting up the execution context with UsePipelineSimulation?
@rcjorgensen could you please provide a sample unit test that the community could use to reproduce the OrgName issue please?
Worth adding the possibility of registering images as well...
Example: Synchronizing some value(s) from contact to a referenced entity and all of the other contacts that also has the same reference.
Therefore i have to compare the old values (PreImage) with the new data (PostImage) to not make endless updates between them.
public void UpdatePerson(ICrmContext context, contact postImage, contact preImage)
{
if (preImage.JobTitle != postImage.JobTitle)
{
new_person updatePerson = new new_person()
{
Id = postImage.new_personid.Id
new_jobtitle = postImage.JobTitle
};
context.CrmService.Update(updatePerson);
}
}
Best way would be to extend the function "RegisterPluginStep" von the context with an additional parameter for images (Name, ProcessingStepImageType - already existing in code, attributes).
This is now part of this issue @psengeis :)
It would be amazing if you have the the time to issue a PR ?