Changing Resharper 5 to support Bdd_style_test_naming

When creating test names, I use a BDD style naming convention to describe the behaviour being tested. As such, I like the naming to be in a particular, consistent style. For example:

image

However, as you can see Resharper is saying there is a problem because of the way the method has been named. Ideally, Resharper should allow this naming convention. With Resharper 5 (maybe in 4.5 too), you can change the setting to match how you want your naming to be.

image

Simply by hitting alt+enter you have some options related to Inconsistent naming.

In the settings dialog, you can set the name style. In my name, First_upper is how I like my tests to be named.

image

Resharper will now accept the naming. As a bonus, if the name happened to be Something_Like_This() then it would detect and provide an option to convert the naming to Something_like_this() keeping your test naming consistent which improves readability. Very cool!

However, the problem now is that ReSharper complaints on production code. For example:

image

Luckily, you can define two possible naming conventions as I’ve done below.

image

Leave a Reply

Your email address will not be published. Required fields are marked *