In this section we will learn to write unit and integration tests for our controllers. There are a number of options available to us for choosing the test framework. We will use xUnit for all our unit tests and Moq for mocking objects. Let's create a xUnit test project by doing the following:
- Open the Let's Chat project in Visual Studio 2017
- Create a new folder named Test
- Right-click the Test folder and click Add | New Project
- Select xUnit Test Project (.NET Core) under Visual C# project templates, as shown here:
- Delete the default test class that gets created with the template
- Create a test class inside this project ...