How can I test private methods with DUnit?
问题 I have a class that I am unit testing into with DUnit. It has a number of methods some public methods and private methods. type TAuth = class(TDataModule) private procedure PrivateMethod; public procedure PublicMethod; end; In order to write a unit test for this class I have to make all the methods public. Is there a different way to declare the private methods so that I can still test them but they are not public? 回答1: You don't need to make them public. Protected will do. Then you can