Exclude auto properties from Code Coverage in Visual Studio 2015

后端 未结 3 1005
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 06:38

I just upgraded a bunch of projects to VS2015/C#6.

Now MSTest\'s Code Coverage analysis is reporting that some auto properties aren\'t covered by unit tests. This wa

3条回答
  •  无人及你
    2020-12-06 07:13

    As a workaround, you can add the following to your .runsettings file:-

    
      
        
          
            
              
                
                  .*get_.*
                  .*set_.*
                
              ...
    

    It's not a great workaround, but as long as you aren't using any functions with "get_" or "set_" in the names it should get you the behaviour you need.

提交回复
热议问题