one of the “hidden” features in the latest typemock release is the fact that the Intellitest suggestion engine is extensible.
I was easily able to add suggestions to create fake objects using another framework.
here’s what the code to create an ISuggestionProvider looks like:
and here’s what it looks like in visual studio:
and selecting the top option leads to:
here’s the complete process:
- Create a new class library
- Add a reference to Typemock.Productivity.Contracts located under [Typemock install dir]Extensions
- Implement the ISuggestion provider interface (only one method)
- the method you implement will give you all the possible types (for the various overload of the method the cursor is in)
- return relevant suggestions based on the type properties (is it an interface? a value type?)
- Compile and deploy the dll to the same Extensions directory where the contracts dll resides
- You’ll need to restart visual studio to see the changes (or enable-disable the typemock productivity addin)
a few notes:
- IntelliTest only works on test methods (a method where there are the relevant XUnit, NUnit or MS Test attributes)
- IntelliTest only works when the project has a reference to one of the major known unit testing framrworks (mentioned above)