Restrict scope to within Namespace usage. #2660
Replies: 3 comments
-
Sharing a method with unit test assemblies is usually done using the InternalsVisibleToAttribute. This has 2 advantages:
|
Beta Was this translation helpful? Give feedback.
-
I would argue that sharing a method with unit test assemblies should always be achieved through it being public. In other words, unless a method is public, then it's an implementation detail and should never be directly tested. If code can't be indirectly accessed through a public API, then get rid of it as it serves no purpose. What's left is then fully testable through tests that simply use those public APIs. The idea that because I declare a type in namespace |
Beta Was this translation helpful? Give feedback.
-
'public' is a mtter of perspective. If i build and deliver an API, i can choose to make it "public" only to a limited set of consumers (using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Restrict a scope to be only accessible to within a namespace, would be used for sharing methods across different assemblies. Without resorting using public methods. Especially useful for unit test assemblies.
Beta Was this translation helpful? Give feedback.
All reactions