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

末鹿安然 提交于 2019-12-03 05:34:11

问题


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


回答1:


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/




回答2:


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



来源:https://stackoverflow.com/questions/3660597/how-to-get-resharper-to-allow-underscores-in-method-names-but-only-in-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!