In this post I reuse my sample project (ported to ASP.NET Core RC2) but add a new Nunit test project to it.
Nunit has no testrunner ready yet that supports testing with dotNetCore. In fact for the moment only XUnit supports the VS2015 GUI testrunner.
NUnit has a lightweight testrunner NUnitLight. DotNet Core supports only two mode, ASP.NET MVC apps and Console apps. So, what I did is use NunitLight inside a .Net Core console.
The code can be found here: https://github.com/geobarteam/myClub/tree/1-4.Add.NUnit.TestProject
- You should start by adding a new .Net Core Classlibrary project and addd the NUnit & NUnitLight dependencies.
$ yo aspnet
- Modify the project.json file
- Modify the program.cs file
- Add a Nunit test file: SampleTest.cs
- Start the test session with “dotnet run” , you can also launch the test project and debug it through VS2015.