Defining C# test projects in Visual Studio
The .NET SDK contains project templates for three types of unit testing frameworks: MSTest, xUnit, and NUnit. When starting the new project wizard in Visual Studio, if you want to see the compatible versions of these testing frameworks for .NET C# applications, set the Project type to Test, the Language to C#, and the Platform as Linux. This configuration will allow you to identify and select the appropriate versions of MSTest, xUnit, and NUnit for your project.
The following screenshot shows the selection that should appear:
Figure 9.2: Adding a test project
All the preceding projects automatically include the NuGet package for running all the tests in the Visual Studio test user interface (Visual Studio test runner). However, they do not include any facility for mocking interfaces, so you need to add the Moq
NuGet package, which contains a popular mocking framework.
All these test projects must contain a reference to...