-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
BeEquivalentTo compares explicitly implemented methods of internal interfaces #2811
Comments
You're right. If the interface is |
On second thought, we can't easily fix this. FA doesn't know whether that interface is visible for your code. It could be In the meantime, you can use the overload of |
Yes, that sounds entirely reasonable. Totally forgot about the I'll close the issue then. The behavior is consistent and there is a workaround. |
I'll keep it open to implement the |
Description
I am comparing objects that inherit from a base class from a library assembly that I don't control. That base class implements properties of an internal interface explicitly. Since #2794 / 6.12.2 these explicitly implemented properties are now compared.
This is problematic because
.Excluding
(or.For(..).Exclude(..)
) because I cannot name the property. I cannot name the property because I cannot name the interface (it's internal).IncludingAllDeclaredProperties
doesn't seem to have an effect. Contrary to what the doc comment on the method says, the explicitly implemented property of the internal interface seems to be treated as a public property declared on my type. Sure, interface implementations are technically public, but I would expect the visibility of the interface to "win" here.Reproduction Steps
Expected behavior
Internal interfaces are ignored for
BeEquivalentTo
.Actual behavior
Explicit property implementations of internal interfaces are considered for
BeEquivalentTo
.Regression?
This worked as expected in 6.12.1. It is broken in 6.12.2.
Known Workarounds
Use the
IMemberInfo
overload of.Excluding
.Configuration
.NET 8
Other information
No response
Are you willing to help with a pull-request?
No
The text was updated successfully, but these errors were encountered: