I want a unit test class with an internal
security level in an ASP.NET Core project. I added the AssemblyInfo.cs file to the properties of the test project:
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: InternalsVisibleTo("xxx.xxx.xxxTests")]
However, when I call this in my test:
mockApplicationBuilder.Verify(y => y.UseMiddleware<HttpExceptionMiddleware>());
I'm still getting
HttpExceptionMiddleware unavailable due to protection level
Why is my AssemblyInfo attribute not working?
My setup is that I have a solution with two folders (src and tests), and these folders have an src project and a test project in the root folder, respectively. The AssemblyInfo.cs file is in my properties of my src project. Do I need to specify the full path to the test project in my assemblyInfo.cs attribute?
My test project also has AssemblyInfo.cs
, although I believe it doesn't matter.
source share