unit-testing.net-corenunitrider

Running nUnit tests for .NET Core in Rider


It might be a simple question, but it seems I can't figure out how to combine NUnit and a .NET Core project in Rider.

It is nowhere in the templates and if I just create a simple class library and reference a NuGet package I guess that is not the option. None of the usual NUnit items are recognized even if I reference using NUnit.Framework just like it is referenced in the usual .NET.

Either I don't know something or it is not yet supported. Has anyone had any experience in using NUnit with .NET Core in JetBrains' Rider IDE?

I know there is MSTest and xUnit available, but I am really used to NUnit, so I really want to make sure there isn't any workaround.


Solution

  • So here is how I did it thanks to the article .NET Standard and .NET Core unit tests not discovered with new .csproj format in Visual Studio 2017 .

    1. Create an empty .NET Core Class Library

    2. Unload the project

    3. Edit the .csproj file. For some reason it points to target netstandard2.0. Set it to point to netcoreapp2.0.

    4. Download NuGet Packages

    1. Reference your the .NET Core project you want to test in the dependencies

    2. Start testing using NUnit.Framework;