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

Implement Min and Max 'Top' attributes for FetchXml and QueryExpression #537

Open bwmodular opened 3 years ago

bwmodular commented 3 years ago

Queries should prevent any requests where 'top' is less than 0 or more than 5000 with the exception: Expected value between 0 and 5000 inclusive.

jordimontana82 commented 3 years ago

This is an interesting one, does this limitation apply across all versions of Dynamics / CDS / Dataverse, Ben?

bwmodular commented 3 years ago

HI @jordimontana82, I've not been able to find anything to suggest that this is not implemented across all versions, and I've tested in 2015 on-prem, 2016 on-prem and 365 online. However, to be safe, in case it changes, or it is possible to overwrite the min and max at the database level, we could create 'MaxTopCount' property of the faked context, default it to 5000 but allow it to be set to a different value at run time? We do already have a 'MaxRetrieveCount' property, which defaults to 5000, but this isn't used to restrict the 'Top' value in queries, only to restrict the number of records actually fetched. Could we/ should we use that?