Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to define custom naming conventions for resharper?

Tags:

resharper

I'm using Resharper (with the StyleCop plugin, although I don't think that's relevant to the question/answer) to enforce naming conventions amongst other things in our code base. Pretty much everywhere this works brilliantly, with one exception.

For test method names I prefer the following convention:

ThingOrBehaviourUnderTest_Action_ExpectedOutcome

Currently this results in an inconsistent naming warning and to-date I've just ignored it (I know I can disable the warning in that file, but then it disables the warning for all any other naming inconsistencies). In the list of styles I can assign Resharper offers camel case, which would result in:

ThingOrBehaviourUnderTestActionExpectedOutcome

or underscore separated words:

Thing_or_behaviour_under_test_action_expected_outcome

Both are close to what I want, but not quite there. I guess I'm after a way of allowing underscores as valid characters in camel cased test method names, or a way of supporting a custom naming convention. Is this possible?

like image 953
FinnNk Avatar asked Oct 16 '10 23:10

FinnNk


1 Answers

I know this question is pretty old, but ReSharper 7 now finally supports the definition of extended naming rules. Those make it possible to have separate name styles for test methods.

like image 155
Florian Greinacher Avatar answered Nov 12 '22 08:11

Florian Greinacher