xunitcontrib + ReSharper 4.5.1

by Matt 31. July 2009 16:03

Just the other day, JetBrains released ReSharper 4.5.1. There are no major changes; it’s a maintenance release.

And the good news is, the latest version of xunitcontrib (0.3.1) works just fine with it. No changes. Nothing.

But there’s one nice, new, quiet, little feature.

ReSharper 4.5 added naming style rules, such that you would get a visible squiggly warning when classes weren’t named InCamelCase and variables weren’t lowerCaseCamel.

Too bad for those upstart BDD folks that like to ape Ruby with Significant_use_of_the_underscore_character when naming their tests (“underscore porn”). These guys would get a warning under their test methods.

ReSharper warns that test method does not match naming standard

We can fix this in 4.5.1 by adding a user defined naming rule. Go to the ReSharper options dialog, and select Naming Style from the tree on the left hand side. Then select Add in the bottom half of this dialog. We get a new window:

The ReSharper user defined naming rule dialog

We want to set the rule just as in the picture – give it a description, select Test type and Test method (property) and then select First_upper.

And now our Interestingly_named_methods are no longer marked as being non-standard, and our “normally” named tests are prompted for renaming.

BoringCSharpNamingStandard

Cool. But what about your existing, non-BDD style tests? You don’t have to rename those. Simply add a new naming style to the rule you’ve just created. So not only does the rule for test elements enforce Uppercase_with_underscores, it also enforces UpperCamelCase. Very handy.

And in case you missed why I’m pointing this out, ReSharper is smart enough to realise that this rule applies to any test identified by a test provider, such as xunitcontrib. Those examples above are xunit Facts.

And the best bit? I didn’t have to do any work.

Tags: , ,

Comments (16) -

Peddos
Peddos
4/19/2011 11:00:05 AM #

I really loved your blog! I got a porno for you, check it out.

Reply

some free stuff
some free stuff
5/6/2011 8:24:49 PM #

thats very well written =]. i do find most of the stuff you have mentioned very useful and connecting to my audiences. if only i have learnt about all this stuff earlier. i only discovered them in recent months.

Reply

suv comparison
suv comparison
7/20/2011 10:25:43 PM #

Per il tuo bambino scegli Moncler. Una scelta di capi, estivi ed invernali, eccezionali. Tuo figlio sarà sempre alla moda e potrà muoversi in totale comodità.

Reply

hybrid vehicle
hybrid vehicle
7/21/2011 12:48:28 PM #

Fantastic task I like your type! Would really like to right here your feedback on my website! I am also seeking for someone to help you me make websites!

Reply

Douglas Ramler
Douglas Ramler United States
1/6/2016 2:49:39 PM #

Congratulations, Neil! I love this site and I know I'll love the book. Christmas, birthdays, Father's Day 2010  check!

Reply

Rich Bowdry
Rich Bowdry United States
1/15/2016 4:33:55 AM #

the style of keeping you connected with so many things of different types is awesome and you find it interesting everytime.

Reply

Micheline Trafton
Micheline Trafton United States
1/15/2016 4:57:02 AM #

Thaaaat IS awesome! lol hehe

Reply

Francisco Brixner
Francisco Brixner United States
1/15/2016 6:06:29 AM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Wai Freifeld
Wai Freifeld United States
1/15/2016 6:07:42 AM #

Let me be the first to say: Congrats, Neil! I've been following this site from day one, and have loved every single day of awesomeness that it has delivered. You deserve all the success coming your way. Keep it up!AWESOME!

Reply

Micheline Trafton
Micheline Trafton United States
1/15/2016 6:43:18 AM #

Congratulations, Neil! I love this site and I know I'll love the book. Christmas, birthdays, Father's Day 2010  check!

Reply

Betsy Ragans
Betsy Ragans United States
1/15/2016 7:12:00 AM #

getting laid AWSOME

Reply

Jose Bacone
Jose Bacone United States
1/15/2016 7:15:18 AM #

Thaaaat IS awesome! lol hehe

Reply

Thersa Tomich
Thersa Tomich United States
1/15/2016 8:27:47 AM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Patrica Guccione
Patrica Guccione United States
1/15/2016 8:29:06 AM #

Congrats! This is such a great website, I know it will translate well into book form. Which is AWESOME!

Reply

Dan Geschke
Dan Geschke United States
7/13/2016 4:05:33 AM #

thanx for the post

Reply

webjob
webjob United States
8/29/2016 8:14:05 AM #

I am following often your posts and I noticed that every post contains an informative value. I have benefited from your website in many ways and I suggested this site to my friends.There is no doubt that they will like it.

Reply

Add comment

biuquote
  • Comment
  • Preview
Loading

Rel=Me

Month List

RecentComments

Comment RSS