c# - How to unit test private methods in BDD / TDD? -
I am trying to program according to behavioral evolution, which states that no line of code fails to test the unit Should be written without having to first.
My question is, how to use BDD with private methods?
How can I test the unit personal way?
: What is a better solution than this:
- When using personal methods first in public and then making private, I use those public methods that use those personal methods;
or
- All personal methods in C # using the Internal and InternalVisibleTo attributes.
Robert
When you write a code test for the first time, you do not have any personal methods at this point in the public interface.
Then you write the code to pass the exam. If any code is considered in the private system, then it is not important - it should still be there because it is used by the public interface.
If the code is not written before the test, then - pure, anyway - the reflection can be used directly to offend personal methods; Although this is a technique of the last resort.
Comments
Post a Comment