Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« Agile Testing tools List | Main | Unit Testing decoupled from TDD as well== Adoption »
Thursday
Oct022008

Isolator feature focus: Live objects in unit tests

Here is one feature that sets Typemock Isolator apart from all the other frameworks, that has nothing to do with legacy code: Live Objects.

This feature allows you to just “new” up an instance of an object, if you can, and then fake method results on it, and send it somewhere into production code:

 [TestMethod, Isolated]
public void DoSomething_LoggerHasFullDisk_NothingHappens()
{
RealLogger logger = new RealLogger();

Isolate.WhenCalled(()=> logger.IsDiskFull).WillReturn(true);
   new MyClass(logger).DoSomething();..

}

With any other framework you are forced to “mock” or “stub” the RealLogger class to begin using it. Removing this need makes for clearer more elegant tests. This feature is already available in Isolator 5.1 that was released this week.

PrintView Printer Friendly Version

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>