Testing .Net Core Library with xUnit

I create .Net Core Librarythat can be used by the application ASP.NET Core. By default, Visual Studio creates project.json as shown below.

{
  "dependencies": {

    "NETStandard.Library": "1.6.0"
  },
  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },
  "version": "1.0.0-*"
}

I think it is recommended to use netstandard1.xfor libraries that will be used by other applications. I'm going to remove "imports": "dnxcore50"it because it was for older versions of the .NET Core preview (before the release of the .NET Framework 1.0 RTM and .NET Core RC2)

Now I wanted to unit test this library using xunit, and then the article Getting Started with xUnit.net (.NET Core / ASP.NET Core) , however, xunit suggests marking the library as .Net Core Application

, , , , .NET Core ( netcoreapp1.0). .NET CLI , unit test *, . , , dotnet-test-xunit . Visual Studio, , .

  • xUnit.net, .

, project.josn, , unit test. :

1 > .Net Core netstandard1.6 netcoreapp1.0, ?

+4
1

( project.json), .

.NET Core, . , .

project.json

+2

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


All Articles