Preview and Questions on the next Isolator API
Here is a preview of some use cases from the new Typemock Isolator API coming out sometime in August. I have some questions for you which I’d love for you to answer in the comments.
First, a little background on the new API that should come out sometime in august.
- The new Isolator API goes in the direction of AAA – Arrange,Act,Assert and backs away from the more traditional Record-Replay model.
- No mocks or stubs. Everything is defaulted to a fake object, which can either be used as a stub or as a mock object later on. If at the end of the test you call “Verify” on that object, that it is logically a mock. if you tell that object to return specific values or throw exceptions during the test, it is a stub. but the API does not mention these words for clarity.
- No strings (Except for non public members)
- There is a single point of entry to the API, currently called “MyTest” which is used to create all the types of fakes.
- There are several categories of faking which can be done, and they are represented in the MyTest as properties: “Make”, “Static”, “Swap”,”NonPublic”.
- Make – Creates instances of fake objects to be used later on in the test. can be interfaces or real classes.
- Static – used for faking out static methods or constructors
- Swap: used for replacing objects that will be created in the future with fake objects
- NonPublic – used as the entry point for faking out anything that is not accessible via publicly accessible apis.
Let’s see some use cases:
Use case #1: fake
A simple fake that will be used as a stub(all stubs are non strict by default – you can call any method that is void without getting an exception):