How can I test private methods with DUnit?

后端 未结 7 683
温柔的废话
温柔的废话 2021-01-01 17:41

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)
         


        
7条回答
  •  南方客
    南方客 (楼主)
    2021-01-01 18:22

    With Extended RTTI (Delphi 2010 and newer), invoking private methods via RTTI is another option. This solution is also the top-rated answer in How do I test a class that has private methods, fields or inner classes?

提交回复
热议问题