Reputation: 1842
I am developing an asp.net 5 application targeting dnx451.
The asp.net 5 project relies some libraries with unit-tests written for nunit 2.x. So the reasonable choice for me is to use nunit for testing the asp.net 5 project.
When I running the unit test in ReSharper, the ReSharper says "Test not run" with additional message "System.IO.FileNotFoundException: Could not load file or assembly xxx ".
Both nunit 2.6.4 and 3.0.0-beta-2 results the same error.
Any one has successfully running nunit tests against an dnx project?
Upvotes: 5
Views: 3098
Reputation: 5395
Hopefully, by saying "Especially with ReSharper", you mean that you want to know how to run NUnit tests, and if possible, with ReSharper. That being said, here's how to run NUnit tests against ASP.NET Core (Formerly known as ASP.NET 5) in Visual Studio without needing ReSharper:
"testRunner": "nunit",
Now you can run your tests by choosing Test - Run - All Tests from the Visual Studio menu.
Your project.json file should look like this:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"dotnet-test-nunit": "3.4.0-beta-1",
"ProjectUnderTest": "1.0.0-*",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"NUnit": "3.4.1"
},
"testRunner": "nunit",
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
Upvotes: 0
Reputation: 772
Looks like NUnit has (partial) support as of v3.0.0-RC http://www.alteridem.net/2015/11/04/testing-net-core-using-nunit-3/
Upvotes: 0
Reputation: 7092
NUnit does not support the DNX core.
Follow this issue to see when nunit adds dnx support. https://github.com/nunit/nunit/issues/575
Upvotes: 0
Reputation: 18583
DNX tests aren't currently supported by ReSharper. It's a whole new execution model, and hasn't yet been implemented for ReSharper. I'd expect to see support as DNX and asp.net stabilise and near release. Also, I don't believe nunit itself supports running as a DNX test runner - the xunit team have a separate project to plug into DNX: https://github.com/xunit/dnx.xunit
Upvotes: 3