How to use bdd naming style with Resharper 4.5?

前提是你 提交于 2019-12-04 01:35:14

On the menu:

Resharper | Options -> Languages -> Common -> Naming Style: remove what ever naming style you want. They should have a "disable" feature, but they don't.

If you want to follow the Microsoft style guide with your non-test code sources - Have you tried using the StyleCop for ReSharper plugin?

As recommended before: disable the internal ReSharper naming rule set or toggle the inspection settings. StyleCop (thus the StyleCop ReSharper plugin) allows inheritance over the Settings.StyleCop files in your solution folder structure. So you are able to check for valid names in the "real" sources, while the analysis of the test code is disabled.

Steve Brown

You could use

// ReSharper disable InconsistentNaming

// ReSharper restore InconsistentNaming

around the extremities of each class. e.g

// ReSharper disable InconsistentNaming
namespace bob
{
    [TestClass]
    public class MyTestClass
    {
        [TestMethod] 
        public void Test_Test()
        {
        }
    }
}
// ReSharper restore InconsistentNaming

This however will remove all naming warnings, and not just those on the Method name(s).

I've already added a request for this in the ReSharper bug-tracker. You can vote for it.

Resharper 4.5.1 has added this capability. You can now add a new custom naming rule that applies specifically to a test method, and allow it to contain underscores.

You can use Agent Smith for more precise code naming conventions.

Note: the version for the final R# 4.5 seems not to be compiled yet... but I'm sure it will be there soon.

There is no need to remove rules. New Rule can be added that accept underscores

Resharper | Options -> Languages -> Common -> Naming Style and add new rule to the bottom "User defined naming rules"

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