The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • @matijn (: Enneh: sterkte! 9 minutes ago
    • @IanColdwater Welcome back. I was worried too. Good to know that you are OK. Hope the turned down notifications made things bearable. 12 minutes ago
    • RT @francesc: I updated the slide deck from my "Introduction to Go" at @CERN earlier this year It now includes links to the recordings for… 19 minutes ago
    • RT @danidonovan: therapist: and what do we do when we’re feeling stressed? me: stop making plans, avoid text messages, and accidentally al… 27 minutes ago
    • RT @michaelbolton: 1) Thinking about counting things to measure quality? You might be able to measure *some things* *that bear on* quality.… 30 minutes ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,642 other followers

How do I test an interface? Should I even do that? | Software on a String

Posted by jpluimers on 2014/11/20

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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: