Follow @RoyOsherove on Twitter

Isolator Feature Focus: Duck Typing and Isolate.Swap

Typemock Isolator 5.1.1 has been released, and this release brings with it some awesome (seriously) features that are unique fro any other framework I've seen.

a good overview of features can be found here.

The Isolator Swap feature allows swapping calls between real and fake objects (kind like redirects) so that any relevant calls made against the real object will be redirected and invoked on the fake object.

Here's how you use it:

image

Unlike doing a standard "WhenCalled()" on some object method and telling what its custom behavior will be, "Swapping"  objects redirects all relevant calls(I'll explain what "relevant" means in a second) to the fake object which you have created.

 Duck Typing Awesomeness

Another cool thing about it is that "Duck" and "Dog" don't have to have a shared interface or base class. The "Swap" feature will redirect a method call if it exists on the "fake" object, but if it does not, it will invoke the original object. This is one interpretation of what's called "Duck Typing".

The "CallsOn" and "WithCallsTo" methods take an object type, so you can send in anything you want.  if a method on the fake object matches the signature and name of a called method on the real object, the fake method will be invoked.

Isolator Feature Focus: Faking Collections

PDC 2008 Videos