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

FetchXml StateCode Specified Cast is not Valid #612

Open karthikChakravartula opened 5 months ago

karthikChakravartula commented 5 months ago

We have a Custom Entity , we are using fetch Xml to retreive the Record.

When trying to Unit test the method it says Specified Cast is Not Valid when using retreive multiple.

We did generate Early bound Classes as Well.

Not sure what was missing.

Here is the Code below.

_context.EnableProxyTypes(Assembly.GetExecutingAssembly());

var pluginContext = _context.GetDefaultPluginContext();

`_context.Initialize(new List<Entity>() {
        _account,_envVariable
        });`

` var fetchXml = @"

                                            </fetch>";`

        `var rows = _context.GetOrganizationService().RetrieveMultiple(new FetchExpression(fetchXml));`

It is throwing specified error on retreive multiple.