Skip to content

Should().HaveAccessModifier() fails for internal interfaces #1741

@Code-Grump

Description

@Code-Grump

Description

When trying to assert that an interface type has internal access, the following assertion message is thrown:

Expected expression to be Internal, but it is InvalidForCSharp.

Complete minimal example reproducing the issue

Assuming the following definition exists in the scope of the test:

internal interface ITest {}

The following demonstrates the problem:

typeof(ITest).Should().HaveAccessModifier(CSharpAccessModifier.Internal);

Expected behavior:

The assertion should succeed.

Actual behavior:

The following assertion message is thrown:

Expected typeof(ITest) ITest to be Internal, but it is InvalidForCSharp.

Versions

  • Fluent Assertions version: 6.2.0
  • Compiled against .NET 5.0
  • Run against .NET 6.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions