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

Fix MemberPath so that it can exclude overriden members #1087

Merged

Conversation

@Evangelink
Copy link
Contributor

@Evangelink Evangelink commented Jun 24, 2019

Fix #1077

I think that the method IsSameOrInherits should be updated to use IsSubclassOf instead of AssignableFrom to avoid some potential FPs (assignable checks also for cast not only direct inheritance).

@Evangelink Evangelink changed the title Beequivalentto basetype [GH-1077] Fix MemberPath so that it can exclude overriden members Jun 24, 2019
@Evangelink Evangelink force-pushed the beequivalentto-basetype branch from 5125149 to 1f5fb54 Jun 24, 2019
@dennisdoomen dennisdoomen changed the title [GH-1077] Fix MemberPath so that it can exclude overriden members Fix MemberPath so that it can exclude overriden members (1077]) Jun 24, 2019
@dennisdoomen dennisdoomen changed the title Fix MemberPath so that it can exclude overriden members (1077]) Fix MemberPath so that it can exclude overriden members Jun 24, 2019
Tests/Shared.Specs/BasicEquivalencySpecs.cs Show resolved Hide resolved
Loading
@Evangelink
Copy link
Contributor Author

@Evangelink Evangelink commented Jun 25, 2019

@dennisdoomen What do you think about creating a new PR to change IsAssignableFrom to IsSubclassOf?

Loading

@dennisdoomen
Copy link
Member

@dennisdoomen dennisdoomen commented Jun 25, 2019

What do you think about creating a new PR to change IsAssignableFrom to IsSubclassOf?

I don't quite get why. IsSameOrInherits implies that it'll return true if the type is the same or inherits from it and supports interfaces as well.

Loading

@Evangelink
Copy link
Contributor Author

@Evangelink Evangelink commented Jun 25, 2019

Current implementation is probably good enough but IsAssignableFrom also handles cast. So if you have type A with property Foo and type B with the same property name and B has the implicit cast operator this would return true.

Loading

jnyrup
jnyrup approved these changes Jun 26, 2019
@dennisdoomen dennisdoomen merged commit fdc2c7d into fluentassertions:master Jun 26, 2019
1 check passed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants