Can I define user naming conventions for resharper?

I use Resharper (with the StyleCop plugin, although I don't think this relates to the question / answer) to enforce naming conventions among other things in our code base. Almost everywhere it works brilliantly, with one exception.

For test method names, I prefer the following convention:

ThingOrBehaviourUnderTest_Action_ExpectedOutcome

This currently leads to an incompatible name warning and date. I just ignored it (I know I can turn off the warning in this file, but then it turns off the warning for all other naming inconsistencies). In the styles list, I can assign Resharper to the camel case, which will result in:

ThingOrBehaviourUnderTestActionExpectedOutcome

or underline highlighted words:

Thing_or_behaviour_under_test_action_expected_outcome

Both are close to what I want, but not quite there. I assume that after you have allowed underlining as valid characters in the names of camel testing methods, or a way to support a custom naming convention. Is it possible?

+7
resharper
source share
2 answers

I know this question is quite old, but ReSharper 7 now finally supports the definition of advanced naming rules . This allows you to create separate name styles for test methods.

+6
source share

The AgentSmith plugin for ReSharper should meet your needs with support for regex rules.

+4
source share

All Articles