I read the following article, which do describe it for Java, but the same problems apply for vb.net (except I dont know if .net reflection allows one to access private methods like java)
Testing Private Methods with JUnit and SuiteRunner
As you will see, there is no nice way to do it, so I think I will try to rethink the design, and then see if I really need to test a private method.
Finishing with a quote:
In general, you don't want to break any encapsulation for the sake of testing (or as Mom used to say, "don't expose your privates!")
By Dave Thomas and Andy Hunt, in their book Pragmatic Unit Testing.
No comments:
Post a Comment