This is a continuation of the unit testing the Metric Dashboard series, you can find part 1 here
Passing a fake object to constructor
At one point I had to pass a fake object into the constructor. Here I used a feature that will be available in our next versions. This feature currently called intelliTest makes it much easier to create fake objects without needing to go back and forth in the code.
Stage one – when in a correct position the intelliTest window appears
Clicking it opens a new window with the options of types to fake
Choosing the Fake, will:
- Create the fake in the test code
- Insert the local variable in the method
- Add the [Isolated] attribute to the test
- Add the correct using statements and
- Add the correct references to the project
It is really great fun using this feature as it take away all the plumbing work and sets everything up for me.