在Visual Studio 2012 Express上通过Nuget的NUnit.Runners不起作用

Mic*_*hal 7 .net nunit nuget visual-studio-2012

我正在尝试使用NuGet管理器在Visual Studio 2012 Express中设置简单的NUnit项目.从PROJECT->管理NuGet包我安装了NUnit(框架)并想要添加NUnit.Runner但是在安装过程中我收到了:

'NUnit.Runners 2.6.2' already installed.
Run Code Online (Sandbox Code Playgroud)

好的,但是当我转到TOOLS-> Library Package Manager-> Manage for NuGet Packages for Solution时,NUnit(框架)和NUnit.Runners都会显示为已安装.

我可以在代码中使用NUnit框架,但是当我尝试运行测试时,旧的"测试资源管理器"会停留并且不会显示任何内容.不会调用测试.

我在VS2012或NUnit配置中遗漏了什么?

Mic*_*hal 6

As I've found out Visual Studio Express does not support project extensions (forbidden and disabled by Microsoft). So it seems there's no option to use NUnit without some workarounds. So far I installed full version and there NUnit runner works as expected.


tob*_*sen 5

您还可以使用此博客文章评论中提到的方法sombody :

  1. 在测试程序集中添加对nunit-console-runner的引用.

  2. 在您的测试装配中,使用以下一个衬管制作一个类(见下文)

  3. 打开测试程序集的属性.例如,右键单击装配并选择"属性".

    1. 在Application选项卡上,选择Output Type:Windows Application; 和启动对象:NUNitConolseRunner(上面的文件).

    2. 在"调试"选项卡上,在"命令行参数"中输入.csproj文件名; 并浏览到工作目录中的.csproj文件的文件夹.

  4. 保存所有内容,设置断点并使用F5或绿色箭头按钮运行.

码:

using System;
namespace MotorExampleTests
{     
    // Written by blokeley
   class NUnitConsoleRunner
   {

     [STAThread]
     static void Main(string[] args)
     {
         NUnit.ConsoleRunner.Runner.Main(args);
     }
   }
}
Run Code Online (Sandbox Code Playgroud)