Another cool feature in Isolator is the ability to fake values that will be returned from custom collections (anything that inherits from IEnumerable as long as it is not in mscorlib - for example - sharepoint lists).

With the new version you can now do the following with collections:

1) Return a fake value from a specific collection item (even if the collection has not been faked yet)

image

 

2) Return a list of fake values when someone uses the collection

image

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.

I’m not at PDC, and you may not be either. but the session videos are starting to become available. Go to the channel 9 PDC videos sections and look for sessions with the graphic:

WindowClipping (29)

Sessions I’ve set myself to watch:

Dror Helper just created a utility that tracks your StackOverflow ranking. SO, if you're an ego freak, go get it.

image

Posted by RoyOsherove | 4 comment(s)
Filed under:

update: added a check for IsPrivate based on the comments.

so I won't forget: here's how you can iterate over a type definition's methods and see if one of them is an explicit intreface definition:

 

foreach (var info in GetType().GetMethods(
         BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.DeclaredOnly))
  {
   if (info.IsFinal && info.IsPrivate)
   {
         Console.WriteLine("Explicit interface implementation: {0}", info.Name);
   }
  }

 

this will show only the "Write" method for the following class:

public class Class1 : ILogger
{
public void show()
{
} 
void MyMethod()
{
}
void ILogger.Write(string s)
{
}
}
Posted by RoyOsherove | 16 comment(s)
Filed under:

James, I would love to see you take the idea of “SharpMock” to the next level. If not anything else, it would be an interesting challenge to write about.

James took PostSharp and started looking at the possibility of intercepting static method calls using it’s code weaving API. Nice idea!

James, you are totally deserving a free Typemock Isolator Pro license for your efforts. Ping me at royo at Typemock.com and I’ll hook you up!

Posted by RoyOsherove | 2 comment(s)

Two features that Typemock Isolator has make the debugging experience with it very different than any other isolation framework:

1) Highlight fake method during debugging

 

WindowClipping (28)

When stepping into a method that is being faked by the test, the method will be outlined with a nice purple line around it, notifying the user that the real method will not be called, but instead will be intercepted by Typemock Isolator.

2) Fake method and property evaluation in the debugger does not break the test

With other frameworks, if, during debugging, you evaluate (even by mistake, by opening a watch window for example) the value of a fake property of a method, the isolation framework will treat this action as if it was run from production code, and so you might fail the test or cause unknown behavior from the faked methods or properties.

Isolator is smart enough to detect such actions and will do two things:

  • Return the fake value that was assigned to that method or property to see in the debugger
  • Ignore this action as if it never happened so the test can continue as is even during debugging
Posted by RoyOsherove | with no comments

image I’m happy to report that my book has finally hit the “last review” stone, which means all chapters are done and the book should be in book stores around jan-feb 2009. If you’d like to read the E-Book version right now(PDF) you can purchase that for a lower price at the manning site.

I’m also announcing a Wiki site for the book, with all the chapters listed, along with errata and your comments as time goes by. The site already contains the first paragraph of all chapters, with Chapter 1 available for free download, and the full text of the “Tools and frameworks” appendix.

Since its all in a wiki, feel free to add your own tools in there that you think would be valuable, create your own pages that talk about things you think people reading this book should read and more.

I hope the site becomes a good place for guidance for beginners and advanced in the field of unit testing (does not have to be in .NET).

Oh, and you can see the final book cover on the right.

Update: We have already found a designer. Thanks for sending all those emails!

We are looking for a part\full time graphics designer.

the initial need is to create great icons, design logos and such. If that person also has web design skills, all the better, as our site is going to be revamped and redone.

We have no problem working with people offshore and online, so if you're interested or know someone who's amazing at this kind of stuff, email me at (already found a designer - sorry!) Update: We have already found a designer. Thanks for sending all those emails!

Posted by RoyOsherove | with no comments
Filed under:

If you're into multi threading, how about a little deadlock challenge?

Posted by RoyOsherove | with no comments
Filed under:
More Posts « Previous page - Next page »