I use Resharper templates (among other features) on a daily basis. Most of them create very small pieces of code that I use VERY frequently. For instance, I have a set of templates that help me build out my test classes and cases very quickly. One of the very cool features you can add to your templates is to use Macros that let’s R# do more work for you.
The lates template I created was to create the MockRepository.GenerateStub<Type>() line for me. It’s a simple one liner, with one variable $INTERFACE$
I then added a Macro to the template to guess the type the variable should be.
Now I can use this macro ( it’s named gs) on this line.
And it fills out the generic type of the GenerateStub method for me.
As you can see, this is really a big time saver, especially for the really tedious generic types. Small time optimizations like these add up over a few hundred tests.
Post Footer automatically generated by Add Post Footer Plugin for wordpress.