如何配置 Resharper 以使其“允许”方法名称中有下划线吗?
我正在将 NUnit 与 Resharper 结合使用。
对于普通方法,我使用 Pascal 大小写约定,例如 MethodName()。
我想在我的测试方法中使用以下模式,因为它们的名称会很长,因此变得更具可读性,但是,Resharper 抱怨该模式应该没有“_”。
[Test]
public void LoginRegisterPage_WithValidEmailAddress_ShouldSendReminderEmail()
{
}
如何配置 Resharper,使其允许在方法名称中包含下划线而不引发警告?
我去了Resharper>选项>语言> C#> C# 命名风格 >覆盖自定义设置/高级设置并添加一个带有“_”的选项,但发生的情况是,它现在要求我的所有方法都被很好地命名,而我只是希望能够允许这种语法。
希望问题清楚。
I'm using NUnit with Resharper.
For normal methods I'm using Pascal casing convention e.g. MethodName().
I'd like to use the below pattern for my test methods because they become more readable as their names would be long, however, Resharper complains that the pattern should be without "_".
[Test]
public void LoginRegisterPage_WithValidEmailAddress_ShouldSendReminderEmail()
{
}
How to configure Resharper so that it allows having underscore in method names without throwing warnings?
I went to Resharper > Options > Languages > C# > C# Naming Style > Override Custom Settings / Advanced Settings and added an option to have "_" but what happened is that it requires now that all my methods to be named well whereas I just like to be able to allow this syntax.
Hope the question is clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转到 Resharper 选项、C#(或支持的任何其他语言)和命名样式。
您可以选择“方法”并选择“all_lower”选项。
如果您将其添加为另一个选项,它不会给您带来任何麻烦。
Go to Resharper options, c# (or any other language supported) and naming style.
You can select "Method" and have the "all_lower" option selected.
If you add it as another option it should not give you any trouble.