How can I test private methods with DUnit?

后端 未结 7 699
温柔的废话
温柔的废话 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:11

    In general, when I get in this situation, I often realize that I'm violating the single responsibility principle. Of course I know nothing about your specific case, but MAYBE, that private methods should be in their own class. The TAuth would than have a reference to this new class in it's private section.

提交回复
热议问题