简体   繁体   English

Resharper将我的NUnit测试标记为未使用

[英]Resharper marks my NUnit tests as unused

I'm using Visual Studio 2008 and NUnit 2.6.3 together with Resharper 8.2 我正在将Visual Studio 2008和NUnit 2.6.3与Resharper 8.2一起使用

Resharper recognizes my Unit tests (so I can run them with Resharper) but yet they are all marked as unused (classes as well as the individual test methods). Resharper可以识别我的单元测试(因此我可以使用Resharper来运行它们),但是它们都被标记为未使用(类以及各个测试方法)。 I know how to suppress the warning with a comment at each test class but I am looking for a solution without such comments because they also affect test code that is really unused (and thus I should be warned). 我知道如何在每个测试类中使用注释来抑制警告,但是我正在寻找一种没有此类注释的解决方案,因为它们还会影响确实未使用的测试代码(因此应警告我)。

From my understanding this should work out of the box for NUnit tests but I can't manage to make it work. 据我了解,这对于NUnit测试应该是开箱即用的,但是我无法使其正常工作。 Do I have to change some settings? 我需要更改一些设置吗? I googled quite a while but didn't find anything. 我用谷歌搜索了很长时间,但没有找到任何东西。

You need to install ReSharper ExternalAnnotations to solve the problem. 您需要安装ReSharper ExternalAnnotations来解决此问题。 VS2008 does not support ReSharper Extension Manager, so please install it manually: VS2008不支持ReSharper Extension Manager,因此请手动安装:

  1. Download nuget package ; 下载nuget包 ;
  2. Open it using any archiver software like WinZip; 使用任何存档软件(如WinZip)打开它;
  3. Extract all folders from ..\\ReSharper\\vAny\\annotations\\ to C:\\Program Files (x86)\\JetBrains\\ReSharper\\v8.2\\Bin\\ExternalAnnotations ; 将所有文件夹从..\\ReSharper\\vAny\\annotations\\提取到C:\\Program Files (x86)\\JetBrains\\ReSharper\\v8.2\\Bin\\ExternalAnnotations ;
  4. Then restart Visual Studio; 然后重启Visual Studio;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM