Here, we will see how we can use some of the most popular unit test frameworks with .NET Core. This won't be an in-depth coverage of the frameworks, just the basics to get you started.
Unit tests are first-class citizens in .NET Core and have their own project types. Essentially, a unit test project uses the Microsoft.NET.SdkSDK,but must referenceMicrosoft.NET.Test.Sdk. Thedotnettool knows about these projects and has special options for them, as we will see.
First, we need to create a unit test project using one of the supported frameworks.
Unit test frameworks
There are a number of unit test frameworks out there, but I picked the ones that are most often used, including by Microsoft.
MSTest
MSTest is Microsoft's own test framework, recently made open source. To use MSTest, you need to add a reference to the following NuGet packages:
-
MSTest...