I just wond开发者_如何学运维er if I want to make my code more testable, should I use private variables?
If not, when should I use private variables?
Private variables should just be used for internal storage for your class not testing directly against. Set up your class how it is designed to be accessed with the proper properties and methods, then write your test to access your properties and methods just as any other part of your code would.
精彩评论