How to unit test private methods in BDD / TDD?
Posted
by robert_d
on Stack Overflow
See other posts from Stack Overflow
or by robert_d
Published on 2009-10-17T22:22:28Z
Indexed on
2010/04/11
19:03 UTC
Read the original article
Hit count: 244
I am trying to program according to Behavior Driven Development, which states that no line of code should be written without writing failing unit test first.
My question is, how to use BDD with private methods?
How can I unit test private methods?
Is there better solution than:
- making private methods public first and then making them private
when I write public method that uses those private methods;
or
- in C# making all private methods internal and using InternalsVisibleTo
attribute.
Robert
© Stack Overflow or respective owner