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
263 stars 182 forks source link

AddToQueueRequest behavior not equal to Dynamics CRM/365 behavior #288

Open devbeard opened 6 years ago

devbeard commented 6 years ago

Not certain if this is an issue, a design choice, out of scope or something else, but would be great to get some insight into the details no matter what the case is.

Issue: When a queue enabled entity (like email, task, case) is added to a queue in CRM/365 using the AddToQueueRequest, an instance of a QueueItem is normally created like you can see in line 34 of AddToQueueRequestExecutor.cs

However, the behavior is more complex than implemented in FakeXrmEasy. If already added to a queue and state is active, any activity (in reality queue item) except Email will be "moved" to the new queue. Emails, if I am not mistaken, is the only entity that can have multiple active queue items. If only one active queue item, the queue item will be moved. If multiple active queue items, a new one will be added.

Example of consequences: If you write business logic to f.ex. automatically move emails to different queues than where they arrived based on machine learning categorization, word matching, or any other algorithm, your tests might fail because it was not moved but duplicated. When running integration tests or automated UI tests the results will be different.

https://github.com/jordimontana82/fake-xrm-easy/blob/1a305b8cd9c35d3d77e21b00282be566b48d0a09/FakeXrmEasy.Shared/FakeMessageExecutors/AddToQueueRequestExecutor.cs#L34

jordimontana82 commented 6 years ago

Thx for raising this @devbeard . Agree, it would be ideal to replicate that behavior in FakeXrmEasy too.

Copying @vjain90 who added this message. Would you like to take a look at this?

vjain90 commented 6 years ago

Thanks @devboard for raising this concern. Will analyse and amend the code to fit the scenarios.

jhofer commented 3 years ago

Would be nice to have a fix for this

jordimontana82 commented 3 years ago

@vjain90 wondering if you had a change to look into this?

vjain90 commented 3 years ago

@devbeard: That's a really good point! I'd be happy to dig a little deeper into the behavior and come up with a solution. Please allow me some time to work on it. Thanks.