Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run NUnit tests with Visual Studio 2015 CTP 6?

We have been focusing on the new JavaScript capabilities of Visual Studio 2015 CTP 6 for the past few weeks. We were sorta expecting other basic .NET aspects to just work.

Today, we just tried to add some Unit Tests using NUnit to a WebAPI project and we are 0 for 20 (since it's opening day!) No matter what we try, we can't seem to even be able to add a NuGet package reference to NUnit (including 2.6.4 and 3.0.0-beta1).

Anybody have any suggestions on how to get NUnit tests to work with against ASP.NET 5 WebAPI projects?

Here is what we are doing:

VS2015 About box

Adding the new 4.6 ASP.NET 5 project

VS2015 Add new ASPNET 5 project

We are interested in the WebAPI stuff:

VS2015 ASPNET 5 project config

We read about issues with NuGet Package manager from NuGet Beta2, so we installed that version. And updated our configuration:

VS2015 NuGet configuration

We can find the NUnit package (3.0 beta)

VS2015 NUnit NuGet page

But in the end, this is all we get in the output window:

VS2015 NUnit NuGet output

And the references are missing:

Missing NUnit references

Here is our Project.json for this project:

{
  /* Click to learn more about project.json  http://go.microsoft.com/fwlink/?LinkID=517074 */
  "webroot": "wwwroot",
  "version": "1.0.0-*",
  "dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta3",
    "Microsoft.AspNet.Mvc": "6.0.0-beta3",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta3",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta3",
    "NUnit": "3.0.0-beta-1"
  },
  "frameworks": {
    "aspnet50": {},
    "aspnetcore50": {}
  },
  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "bundleExclude": [
    "node_modules",
    "bower_components",
    "**.kproj",
    "**.user",
    "**.vspscc"
  ]
}
like image 647
Eric Liprandi Avatar asked Apr 07 '15 14:04

Eric Liprandi


1 Answers

Alright, it turns out that my PostSharp NuGet source was messing with NuGet. I disabled it and things started working. VS2015 NuGet sources

I now have NUnit 3.0 Beta 1 available: NUnit 3.0 beta 1 NuGet outputNUnit 3.0 beta 1 Reference OK

I suspect this is or will be fixed in a recent release of PostSharp or the Package Source.

like image 138
Eric Liprandi Avatar answered Oct 02 '22 01:10

Eric Liprandi