How do you unit test private methods?

前端 未结 30 1848
无人及你
无人及你 2020-11-22 06:44

I\'m building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it coul

30条回答
  •  执笔经年
    2020-11-22 07:48

    There are 2 types of private methods. Static Private Methods and Non Static Private methods(Instance Methods). The following 2 articles explain how to unit test private methods with examples.

    1. Unit Testing Static Private Methods
    2. Unit Testing Non Static Private Methods

提交回复
热议问题