Please someone add the Software on a String blog to DelphiFeeds (:
Great article on testing implementations of interfaces in a generic way. With examples in NUnit and DUnit.
How do I test an interface? Should I even do that? | Software on a String.
And then Stefan Glienke made a great comment at https://plus.google.com/u/0/+MarjanVenema/posts/Dgb8WADLwXZ making the DUnit implementation even easier:
But even if you go without that extra base class the cool thing is that you don’t need to restrict your classes to be a TInterfacedObject but specify the interface they need to implement (yay, compiletime type safety) and then you can get rid of the Supports call and directly assign the result of the ctor call to the sut variable.
–jeroen
Stefan’s code:
Filed under: Delphi, Delphi 2007, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development
![](http://pixel.wp.com/b.gif?host=wiert.me&blog=7443331&post=25131&subd=wiert&ref=&feed=1)