Creating unit tests for .net5 projects

Trying to switch from .Net4.5 to .Net5, so I created my solution, which consists of folders called "Solution Elements" and "src".

I managed to create 3 projects using .NET 5. I had to create projects as "Class library (package) - PREVIEW - project template for creating a class library in the form of a NuGet package that can target any platform"

Now I want to put my unit test projects into my solution. I believe that now I need to use XUnit, which has different attributes for tests.

But if I create a Unit Test project, I cannot reference my new .net5 projects.

Can someone point me in the right direction, please.

+5
source share
1 answer
  • Install the SideWaffle Template Pack as.
  • File → New Project → Web → xUnit Test Project.
  • Add your web project to the project.json file.
  • Profit !!!

See here from Sayed-Ibrahim-Hashimi (Microsoft) for more details.

0
source

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


All Articles