I'm starting a new ASP.net vNext / MVC6 project and I want to use xUnit to test it.
I've followed the instructions on the xUnit web site for DNX projects.
When I try to run the tests in Visual Studio, either using the built-in runner or in ReSharper, I get this error message:
If I try to run the tests from the command line, I get this:
xUnit.net DNX Runner (32-bit DNX 4.5.1) Discovering: TA.Product.Tests Discovered: TA.Product.Tests Starting: TA.Product.Tests TA.Product.Tests.Class1.FactMethodName [FAIL] System.NullReferenceException : Object reference not set to an instance of an object. Stack Trace: D:\VS-Projects\TA.Product\src\TA.Product.Tests\Class1.cs(25,0): at TA.Product.Tests.Class1.FactMethodName() Finished: TA.Product.Tests === TEST EXECUTION SUMMARY === TA.Product.Tests Total: 1, Errors: 0, Failed: 1, Skipped: 0, Time: 2.216s
Here's my project.json
file:
{
"version": "1.0.0-*",
"description": "TA.Product.Tests Class Library",
"authors": [ "Tim" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"TA.Product": "1.0.0-*",
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-rc1-build204"
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
I found this question, and my version of the xUnit runner seems to match my DNX version, RC1-Update1.
I also found this question that says my tests must be public, and they are.
An ideas, please?