Creating an IntelliTest suggestion in 5 minutes

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:

image

and here’s what it looks like in visual studio:

image

and selecting the top option leads to:

image

here’s the complete process:

  1. Create a new class library
  2. Add a reference to Typemock.Productivity.Contracts located under [Typemock install dir]Extensions
  3. Implement the ISuggestion provider interface (only one method)
  4. the method you implement will give you all the possible types (for the various overload of the method the cursor is in)
  5. return relevant suggestions based on the type properties (is it an interface? a value type?)
  6. Compile and deploy the dll to the same Extensions directory where the contracts dll resides
  7. 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)