You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Off the top of my head I don't know why IsNotPublic only applies to class types.
Removing it seems to make it work for interfaces as well.
Note, I haven't realized why IsNotPublic can be used to check if a type is internal at all.
To make a failing test I had to ensure that ITest was a non-nested type.
@jnyrup IsNotPublic works here because it'll return true if the type is not nested, and not public. Internal and Public are the only valid type accessibility modifiers that can be used on non-nested types.
In looking at this, I've observed that the same issue will apply to enums as well due to the IsClass check. Additionally, Private Protected is not currently supported for types either, which could be replicated with something like this class.
public class Nested { private protected class PP { } }
I can't determine why exactly the IsClass check was placed there initially. All that it really seems to do is restrict internal interface and value types from being identified as such. If there was some kind of strange runtime created type that could cause weird behavior with this check it would have the same issue if it was marked as public in the IL as there isn't a check for that condition.
Description
When trying to assert that an interface type has
internal
access, the following assertion message is thrown:Complete minimal example reproducing the issue
Assuming the following definition exists in the scope of the test:
The following demonstrates the problem:
Expected behavior:
The assertion should succeed.
Actual behavior:
The following assertion message is thrown:
Versions
The text was updated successfully, but these errors were encountered: