Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This exists (in kind of a hacky way) in C# with the ExternalsVisibleTo attribute. It exposes methods and classes only to specified assemblies (like your unit test assemblies).

https://learn.microsoft.com/en-us/dotnet/api/system.runtime....



You can actually stick this in your csproj. I'm on a phone, so bear with me, but roughly

    <InternalsVisibleTo Include="assemblyname" />
Which means you can do stuff with msbuild props, like auto including a `$(assemblyname).Tests` into your projects.


This exists in many Java based languages, an annotation above a method: @VisibleForTesting or some such.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: