Typemock Isolator 4.2 Beta released with cool new features (Previously Typemock.NET)

We just released the beta of Typemock Isolator 4.2 beta (Previously just named Typemock.NET). You can get it here.

Some of the cool new things:

  • Mocked methods will be highlighted in the debugger if you step into them. in the picture below the "DoSomething()" method is being mocked, so stepping through it means nothing. The line around it signifies this status.

image

  • You can evalutate mocked methods in the deibgger and various watch windows without the original test being affected (so if a mocked method should only return "1" on the first call, even if you evaluate it three times in a watch window it will return "1" in the watch window and also will still work in the test and return "1"
  • You can now mock a non-value type fields on a class (used to be that you could just mock out properties)
  • Supports running along side DotTrace 3.0
  • FinalBuilder Typemock tasks (start,stop, set license + auto deploy)

 

One of the features which people didn't realize are possible with Typemock is Mock chaining. You could essentially write the following:

using (RecordExpectations r = new RecordExpectations())
         {
             MyComplexFactory.GetSomeObject().Manager.DoSomething("a");
             r.Return(false);

         }

if you were using something like RhinoMocks, you'd have to have several stubs that return other stubs: the factory, the object it return, and the manager that object returns. with Typemock it's as trivial as just writing the full call chain and it will just work on the end object as if you did all of that.

You can also write it like this:

using (RecordExpectations r = new RecordExpectations())
         {
             r.ExpectAndReturn(
                 MyComplexFactory.GetSomeObject().Manager.DoSomething("a"),
                             false);
         }

Published Monday, February 04, 2008 8:27 AM by RoyOsherove

Comments

Monday, February 04, 2008 12:59 PM by Jeremy D. Miller

# re: Typemock Isolator 4.2 Beta released with cool new features (Previously Typemock.NET)

using (RecordExpectations r = new RecordExpectations())

        {

            r.ExpectAndReturn(

                MyComplexFactory.GetSomeObject().Manager.DoSomething("a"),

                            false);

        }

The chaining code above is cool.  That's the very first thing I've seen out of TypeMock that looks like an advantage over Rhino for me.

Although, I'll still dissent.  That's a Law of Demeter violation that might be leading poor encapsulation and all the problems that that brings.  Just because you can, doesn't mean you should.

Monday, February 04, 2008 3:02 PM by RoyOsherove

# re: Typemock Isolator 4.2 Beta released with cool new features (Previously Typemock.NET)

Jeremy: not if you're talking about a fluent interface that you're building.

Monday, February 04, 2008 4:23 PM by Jeremy D. Miller

# re: Typemock Isolator 4.2 Beta released with cool new features (Previously Typemock.NET)

Roy:  Actually, it's even more painful with a fluent interface, but that has nothing to do with mock objects at all.

You wouldn't want to test an FI with mock objects.  From painful experience, unit testing a fluent interface works best when you're doing a state based test on the outcome.  I quit trying to "unit test" the individual expressions.  test the results and not the intermediary stuff because the FI expressions go through a lot of churn along the way.

Otherwise you're just going to fall into the overspecification trap.

Monday, February 04, 2008 4:49 PM by RoyOsherove

# re: Typemock Isolator 4.2 Beta released with cool new features (Previously Typemock.NET)

Jeremy: I agree that testing the individual parts of a fluent interface sucks. but with "pure' tdd without using Rhinomocks you're forced either do aan intergration test (state based) which could be painful if the interface does funky stuff with dependencies underneath) or you have to stub out some of the objects in the chain.

My point was that you can create a fluent interface in a TDD fashion by simply expecting on it in a recorder scope and actually using it underneath.

Also, you can create code that USES a FI using TDD by allowing the code you write to use the actual FI which is stubbed out.

# Eli Lopian’s Blog (TypeMock) » Blog Archive » Typemock Isolator - Beta - Better Community

Pingback from  Eli Lopian’s Blog (TypeMock)  » Blog Archive   » Typemock Isolator - Beta - Better Community