ReSharper templates

Posted by Jens Pettersson on August 30th, 2010

I would like to share my small but helpful collection of ReSharper templates. I use ReSharper templates a lot and most specifically while I’m writing tests/specifications or while creating mappings or any other repetitive task that can’t be DRY:ed out. For the moment I only have a couple of Live Templates for MSpec that I use while writing our BDD specifications, but I plan to update this as soon as I need a new template. I lost my old templates in the volcanic ash earlier this year…

This is one example of a template I use when creating a new MSpec class:

image

All this code given to me by writing spec and hitting tab. The duplication of the class name in the FolderSubject attribute is generated as I name my class and is used for our report generator.

Never mind the weird indentation under Establish and Because, it’s Visual Studios way of saying: I don’t like you.

You import the templates by going to ReSharper > Live Templates and then hitting the import-button.

image

You can get the templates from my Github repository. Feel free to contribute with your own ReSharper templates!

//J

More MSpec – ReSharper love

Posted by Jens Pettersson on August 27th, 2010

This is a follow up to the post about how ReSharper and Visual Studio messes with your MSpec specifications.

Resharper has built in support for naming inspections which is great for consistency if everyone in the team follows the same rules, but sometimes you just don’t want it. The most common scenario is when writing BDD specs (with tools like Machine.Specifications or MSpec for short).

image

This is a pretty common specification in our current project, and the class name might seem strange if you haven’t done BDD before. But the beauty of this is that the testing framework generates reports with this convention which is extremely readable for non-techincal people.

It will read something like this:

When an already handled customer is processed
the customer should not be processed further

Or whatever you want to check. Our rake task always generates a html-page with all our specifications in a nice and readable format (more on that in a later post).

Well, back on topic! How do we tell Resharper not to scream WARNING, WARNING! at us all the time. We ARE naming things like this on purpose!

As everything always has been done by someone before, I’m only going to give you a link to the solution: http://www.aspiringcraftsman.com/2010/02/resharper-naming-style-for-machine-specifications/

You can add as many naming styles as you like to suit your specifications.

Happy mspeccing!

//J

PS. If you like the Visual Studio theme I’m using, go grab it from my repository over at github. Be sure to read the readme for the right fonts, otherwise the theme will hurt your eyes and probably your babies or kittens too.

Does ReSharper drive you crazy when using MSpec?

Posted by Jens Pettersson on August 19th, 2010

Ask yourself the question in the topic and if the answer is “Yes damn you, YES!!” then this link tip is for you!

http://codebetter.com/blogs/aaron.jensen/archive/2008/10/19/getting-resharper-and-vs-to-play-nice-with-mspec.aspx

Thank you Aaron Jensen! I was going mad with all the ugly indentations and other noise everywhere.

//J


Copyright © 2010 NullReference. Web hosting.