How to use bdd naming style with Resharper 4.5?

前端 未结 8 1642
你的背包
你的背包 2021-02-19 07:40

I just upgraded to Resharper 4.5 and now see that all my BDDish test methods are marked as not conforming to the naming standard. My naming convention is like this:

<         


        
相关标签:
8条回答
  • 2021-02-19 08:39

    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.

    0 讨论(0)
  • 2021-02-19 08:39

    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).

    0 讨论(0)
提交回复
热议问题