Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Resharper to allow underscores in method names but only in Tests?

I know that there is a way to do this, but I can't find it again.

So, does any one know how to allow Resharper to allow underscores in unit tests?

So, for example I want this to be OK


In MyClassTest.cs

public void MyMethodName_StateUnderTest_ExpectedResult()
{}

But I want this to flag:


In MyClass.cs

public void MyPoorly_Named_Method()
{}

Thanks for any help

like image 570
Vaccano Avatar asked Sep 07 '10 16:09

Vaccano


2 Answers

This post demonstrates how to configure this: http://atombrenner.blogspot.com/2010/07/how-to-change-resharper-naming-style.html

UPDATE: The Machine.Specifications testing framework extends ReSharper to allow for custom naming styles for the tests/specs. Very cool; wish other frameworks did likewise. http://lostechies.com/derekgreer/2010/02/11/resharper-naming-style-for-machine-specifications/

like image 54
Jay Avatar answered Oct 20 '22 15:10

Jay


The AgentSmith plugin for Resharper gives you this level of control over naming.

like image 36
Handcraftsman Avatar answered Oct 20 '22 15:10

Handcraftsman