Isolation Syntax for VB.NET - Your comments please

I'm working on adding a VB.NET Friendly syntax for Typemock Isolator. If you're into VB, I'd love your input on the usability of this API and how to make it better.

We'll start going through several basic scenarios that you can do using Typemock Isolator, and show them in VB proposed syntax:

  • Faking instances of classes or interfaces
  • Setting Stub return values or errors on methods
  • Verifying the methods were called
  • Swapping calls between two types
  • Swapping future instances
  • Faking Non Public Members

 

Faking instances of classes or interfaces

the method Fake() is part of a Module called "Test" so it can be used from the tests easily. You could also write Test.Fake(..) if you wanted.

image

 

Setting Stub return values or errors on methods

here are three examples of returning a fake result from a method or a bunch of methods (below). ThisCall(s) is located on the Module Test so you can also write Using Test.ThisCall.WillThrow(...) if you wanted to.

 

image

Verifying that methods were called

This would go at the end of an interaction test

image

Here's an example of a full Arrange-Act-Assert in a test using VB and fakes:

image

 

One possible thing I am considering is adding Arrange-Act-Assert "Regions" to the test by taking advantage of the "Using" feature:

image

Question #1: What do think about the custom Arrange-act-assert regions? (they are option to use anyway)

Swapping calls between two types

This is the "duck typing" feature we introduced in Isolator: allowing you to make calls on one object be invoked on another, without them sharing the same interface, as long as the method names match.

image

Swapping future instances

Isolator supports faking the next creation of an object type, and replace that with the fake we create:

image

Faking Non Public Members

image

Published Wednesday, November 26, 2008 5:15 AM by RoyOsherove

Comments

Wednesday, November 26, 2008 11:24 AM by Dew Drop - November 26, 2008 | Alvin Ashcraft's Morning Dew

# Dew Drop - November 26, 2008 | Alvin Ashcraft's Morning Dew

Pingback from  Dew Drop - November 26, 2008 | Alvin Ashcraft's Morning Dew

Thursday, January 08, 2009 7:15 PM by Angus McDonald

# re: Isolation Syntax for VB.NET - Your comments please

Roy,

I'm not sure about the Using regions idea. It does make the code break up into more readable chunks, but it feels like a misuse of the "Using" keyword, especially when you then have another "Using" statement straight after 2 of them.

Angus