你如何单元测试的私有方法?单元测试、方法

2023-09-02 10:15:31 作者:独臂大虾

我建立一个类库,会有一些公共和放大器;私有方法。我希望能够单元测试的私有方法(主要是在开发,但也可能是为未来重构有用)。

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 could be useful for future refactoring).

什么是做这种正确的方法是什么?

What is the correct way to do this?

推荐答案

您应该使用 InternalsVisibleToAttribute 。