Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConditionOperator.Null is not working in a nested filter using FakeXrmEasy version newer than v1.51.1 #547

Open
vmarsen opened this issue Feb 2, 2021 · 3 comments

Comments

@vmarsen
Copy link

vmarsen commented Feb 2, 2021

I was trying to write a unit test using a nested filter with ConditionOperator.Null using the latest version of FakeXrmEasy.9 (currently is this v1.57.1). I noticed that the test was not working because of the ConditionOperator.Null in the nestedfilter. Once I downgrade the FakeXrmEasy.9 version to v.1.51.0, the test was successfully. In all later versions the test will fail.

In my program, there are 2 Entities: Person and Employment. An employment is linked to a person and has a startdate/enddate.
Here is the query, I am using:
var query = new QueryExpression { EntityName = Person.EntityLogicalName, LinkEntities = { new LinkEntity { LinkFromEntityName = Person.EntityLogicalName, LinkFromAttributeName = Person.AttributeLogicalNames.Id, LinkToEntityName = Employment.EntityLogicalName, LinkToAttributeName = Employment.AttributeLogicalNames.PersonId, JoinOperator = JoinOperator.Inner, EntityAlias = Employment.EntityLogicalName, Columns = new ColumnSet( Employment.AttributeLogicalNames.Id, Employment.AttributeLogicalNames.StartDate ), LinkCriteria = new FilterExpression { Filters = { new FilterExpression(LogicalOperator.And) { Conditions = { new ConditionExpression(Employment.AttributeLogicalNames.EndDate, ConditionOperator.Null) } } } } } } };

I expect that a person with an employment with an empty enddate (enddate is null) will be filtered, but the test fails. There are no results when retrieving this query.

The file with the demo code can be found here. There, you will see that the test is not working. If you downgrade the project to FakeXrmEasy.9 to version 1.51.0, then you will see that the test is successfully.

FakeXrmEasy versions:
1.50.0 => works successfully
1.51.0 => works successfully
1.51.1 => Not working anymore
1.51.2 => Not working anymore
All later versions => Not working anymore

@vmarsen vmarsen added the bug label Feb 2, 2021
@jordimontana82
Copy link
Owner

Thanks @vmarsen .

May I ask what's the version of the CRM SDK you're using to check?

Cheers

@GeusB
Copy link

GeusB commented Feb 17, 2021

We are currently using 9.0.2.23 nugets

@jordimontana82
Copy link
Owner

Thanks for reporting

@jordimontana82 jordimontana82 added this to the v2.x milestone Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants