Why can't Test Explorer see my NUnit tests for ASP.NET Core MVC?

Visual Studio 2017, .Net CoreApp 1.1 (target structure)

I need to write NUnit tests for my ASP.NET Core MVC web application. I often used NUnit for my desktop projects, which were built on the basis of the .NET Framework 3.5-4.6.1.

I have no problem with xunit, but I would like to use nunit.

Here I saw that in the current case I should include such NuGet packages:

  • Dotnet-test-nunit
  • Nunit

But Test Explorer does not see my tests:

[TestFixture]
public class ProductTests {

    [Test]
    public void Name_Gets_ValidValue() {

        var name = "Bob";
        decimal price = 45.5M;

        Product p = new Product() { Name = name, Price = price };

        Assert.AreEqual(name, p.Name);
    }

    [Test]
    public void Name_Gets_ValidPrice() {

        var name = "Bob";
        decimal price = 45.5M;

        Product p = new Product() { Name = name, Price = price };

        Assert.AreEqual(price, p.Price);
    }
}

Hm ... Good. I tried to add the NUnit3TestAdapter NuGet package (I use alwais it), but this problem does not disappear.

How can i fix this?

+4
1

.NET Core project.json csproj, API- .NET Core, dotnet-test-nunit Visual Studio 2017 .NET Core.

csproj API- Visual Studio, NUnit .NET Core. PR, Visual Studio NUnit Engine.

, - , , . , .NET Core. NUnitLite.

, , .NET Core.

: Visual Studio NUnit, .NET Core. , , . .NET Core NUnit Visual Studio 2017

+4

Source: https://habr.com/ru/post/1675156/


All Articles