Back in 2009 I published ReSharper Live Template For Creating Unit Test Stub. A lot of things have changed since 2009, including my templates. Since I am doing another series of presentations on Test Driven Development I thought I should get these out because people always ask for them.
As stated in my original post these templates are a way for you to create unit test names that help in describing the true intentions of the test and also to provide a common unit test format that will make reading and comprehending your unit tests easier on everyone. And of course as lazy developers any redundancies should be automated!
The first template is for a unit test that does not have specific input criteria.
The second template is for a unit test that has specific input criteria.
You can take the two templates and create new Live Templates and map to whatever key stroke combination you wish. I use ‘tt’ and ‘tw’.
Note: I have been using these Live Templates since ReSharper 3 and I am currently using them in the latest build of ReSharper 6 without any issues so you should be good to go.
As always if you feel these can be improved on or have other Live Templates you want to share let me know in the comments below.
Keith is a Senior Software Engineer with Falafel Software. He has been developing software since 1999 specializing in web-based solutions primarily using the Microsoft stack. He has been a Microsoft MVP in ASP.NET since 2012.
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.