mardi 25 août 2015

Make member public to unit-test it

I know there are many question concerning unit-tests of private members within classes. Most of them come to the conclusion that having private members that need to be tested are a design-flaw that needs refactoring (e.g. see here). However I still have one last question:

When I refactor my private members to new classes they become (public) API-members however which I intended to avoid. So by simplifying our client class we polute our API by designing a new publicly visibly helper-class. Of course one might also write the test-code within the assembly and make those helpers internal but thus we´d also ship test-code to production-site.

I assume there is no right answer to this issue but perhaps you have some great ideas that help to avoid those situations?

Aucun commentaire:

Enregistrer un commentaire