Description
Whenever you have a class that has a method that is protected internal virtual and the project is set to InternalsVisibleTo, TUnit is generating a wrapped mock that does not adhere to the requirements of method accessibility.
TUnit is generating a method that has protected override when the method that is wrapped should contain protected internal override. If the InternalsVisibleTo is removed from the project, it works as expected, but is not ideal as the internal methods are no longer accessible in the tests project.
Expected Behavior
I would expect that if the tests project is allowed to have access to the internals of the root assembly that it would generate the correct access modifiers for protected internal virtual methods.
Expected format:
Actual Behavior
The current behavior is that the internals visible to is not being adhered correctly when generating wrappers for protected internal virtual methods.
The error:
Internals Visible To:
Method:
Generated method:
Steps to Reproduce
To see the issue, use the following project. This project contains the current setup exposing the issue.
If the project is not used, then:
- Create a project that has it's internals visible to set to the tests project
- The project should contain a class that has a
protected internal virtual method
- The test project should attempt to wrap the class in the main project
Sample Project:
TUnitTestApp.zip
TUnit Version
1.45.22
.NET Version
.NET 10
Operating System
Windows
IDE / Test Runner
Visual Studio
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
Description
Whenever you have a class that has a method that is
protected internal virtualand the project is set toInternalsVisibleTo, TUnit is generating a wrapped mock that does not adhere to the requirements of method accessibility.TUnit is generating a method that has
protected overridewhen the method that is wrapped should containprotected internal override. If theInternalsVisibleTois removed from the project, it works as expected, but is not ideal as the internal methods are no longer accessible in the tests project.Expected Behavior
I would expect that if the tests project is allowed to have access to the internals of the root assembly that it would generate the correct access modifiers for
protected internal virtualmethods.Expected format:
Actual Behavior
The current behavior is that the internals visible to is not being adhered correctly when generating wrappers for
protected internal virtualmethods.The error:
Internals Visible To:
Method:
Generated method:
Steps to Reproduce
To see the issue, use the following project. This project contains the current setup exposing the issue.
If the project is not used, then:
protected internal virtualmethodSample Project:
TUnitTestApp.zip
TUnit Version
1.45.22
.NET Version
.NET 10
Operating System
Windows
IDE / Test Runner
Visual Studio
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
dotnet testordotnet run, not just in my IDE