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.
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.
Verifying that methods were called
This would go at the end of an interaction test
Here's an example of a full Arrange-Act-Assert in a test using VB and fakes:
One possible thing I am considering is adding Arrange-Act-Assert "Regions" to the test by taking advantage of the "Using" feature:
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.
Swapping future instances
Isolator supports faking the next creation of an object type, and replace that with the fake we create:
Faking Non Public Members