I am beginner at field TDD. Recently I have conversation with Dror Helper should I test my private methods or not. After I have talked with him and little reconsider I thing we don’t need to test private methods.
If we need to test private methods we can do this trough public methods that call those private methods.
For example if we have one public method that calls one or several other private methods like this:
public static bool LogIn(string userName, string password)
var user = new User(userName, password);
private static bool verifyThatUserIsValid(User user)
throw new NotImplementedException();
So if I want to make unit tests for method verifyThatUserIsValid I can easily make unit tests for method LogIn to test that method. What do you think about this?
If you want to learn more about unit testing I recommend a great book that I love written by real expert:
Book: The Art of Unit Testing