jordimontana82 / fake-xrm-easy

The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
https://dynamicsvalue.com/get-started/overview?source=git
Other
262 stars 182 forks source link

Add support for Alternate Keys on Associate Request #508

Open wingzeroaa opened 4 years ago

wingzeroaa commented 4 years ago

This issue fixed for RetrieveRequest, UpdateRequest and DeleteRequest https://github.com/jordimontana82/fake-xrm-easy/issues/344

However, I need the Associate Request. I am using the Associate Request to link two records, with Alternative Keys. It is working in Dynamics 365, but not in fake-xrm-easy

Could anyone help? Or I should go to make pull request by myself?

Regards, Zhenyu

jordimontana82 commented 4 years ago

Hi Zhenyu,

Thanks for raising this.

I believe this could be fixed by calling ctx.GetRecordUniqueId before checking the record exists in this fake message, isn't it @BetimBeja ?

https://github.com/jordimontana82/fake-xrm-easy/blob/5531248d7e9dc2a112b17735e0bf5939e974d342/FakeXrmEasy.Shared/FakeMessageExecutors/AssociateRequestExecutor.cs#L52-L54

This is how that call looks like in the RetrieveRequest for example:

https://github.com/jordimontana82/fake-xrm-easy/blob/5531248d7e9dc2a112b17735e0bf5939e974d342/FakeXrmEasy.Shared/FakeMessageExecutors/RetrieveRequestExecutor.cs#L35

If you want to submit a pull request by yourself then you're more than welcome, as right now we're focusing into releasing 2.x before we then bring all these PRs into v1.x and v2.x :)

wingzeroaa commented 4 years ago

Hi @jordimontana82

Thank you very much for quick reply. Yes, your new codes are good. That is what I want.

Let me know when this change has been merged into latest version. Then I can get latest from NuGet.

Regards, Zhenyu

BetimBeja commented 4 years ago

Hi @wingzeroaa , I think @jordimontana82 was suggesting a possible solution so you could issue the PR which he will review 😀 If you do Issue a PR, please provide at least one Unit Test for this too. Betim.

jordimontana82 commented 4 years ago

Yes @wingzeroaa , what I meant to say is that merging PRs into master is on hold until v2.x is released.... in the meantime, you could try to fork the repo and apply the patch to your own fork, build it, and reference that build output in the meantime....

Thanks @BetimBeja

wingzeroaa commented 4 years ago

Hi @BetimBeja I see, I will have a try later. I will write Unit Test for this code change of Unit Test tool. Sometime the write Unit Test is harder than write the actual code.

Hi @jordimontana82 Thanks a lot for suggestion. I prefer to use the release version. I can wait until v2.x. I will try to create a PR later