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

Properly recognized non-class types as internal when using HaveAccessModifier assertion #1743

Closed

Conversation

jonathonchase
Copy link
Contributor

@jonathonchase jonathonchase commented Nov 17, 2021

Removes IsClass check preventing enums and interfaces from being recognized as internal types when not nested.

Fixes #1741

IMPORTANT

  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by a new or existing set of unit tests which follow the Arrange-Act-Assert syntax such as is used in this example.
  • If the contribution adds a feature or fixes a bug, please update the release notes, which are published on the website.
  • If the contribution changes the public API the changes needs to be included by running AcceptApiChanges.ps1/AcceptApiChanges.sh.
  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.

…uld not be recognized as internal when using HaveAccessModifier.
@jonathonchase jonathonchase marked this pull request as ready for review November 17, 2021 03:18
@jonathonchase
Copy link
Contributor Author

Closes #1741

@jonathonchase
Copy link
Contributor Author

This is my first time contributing, and I'm not sure if the check list is something I should be filling out, or if that's in place for a maintainer to fill.

Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please give the PR itself also a functional description, for instance, by reusing part of the release notes? Because the title will appear in the auto-generated Github release note.

docs/_pages/releases.md Show resolved Hide resolved
@@ -58,6 +58,36 @@ public void When_asserting_an_internal_type_is_internal_it_succeeds()
act.Should().NotThrow();
}

[Fact]
public void When_asserting_an_internal_member_is_internal_it_succeeds()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also test enums and structs.
You could modify
When_asserting_an_internal_type_is_internal_it_succeeds and When_asserting_an_internal_type_is_protected_internal_it_throws
from a [Fact] to a [Theory] covering class, interface, enum, struct.

@jonathonchase jonathonchase changed the title Fixes to Issue 1741 Properly recognized non-class types as internal when using HaveAccessModifierCheck Nov 21, 2021
@jonathonchase jonathonchase changed the title Properly recognized non-class types as internal when using HaveAccessModifierCheck Properly recognized non-class types as internal when using HaveAccessModifier assertion Nov 21, 2021
@dennisdoomen
Copy link
Member

@jonathonchase are you planning to follow-up on @jnyrup's comments?

@dennisdoomen
Copy link
Member

Replaced by #1793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should().HaveAccessModifier() fails for internal interfaces
3 participants