How do I fix my Unit Test to have global access to everything?
Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc.
However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't fi开发者_Go百科nd the setting.
Can anyone tell me how to enable it after the project has been created?
In short you need the InternalsVisibleToAttribute
However, I would strongly argue against testing private members in your unit tests. You want to test behavior and not implementation details. If you test implementation details then your tests will become brittle and refactoring will be hard.
精彩评论