Writing unit tests

In this section, we will add a test project using ASP.NET Core 2.0 and write unit tests using xUnit. Before we start writing tests, we should set up a test project in our existing application.

The following are a few simple steps needed for our test project setup:

  1. From Solution Explorer in Visual Studio, right-click on Solution 'Chap06_01' (1 project) and click on Add | New Project... , as shown in the following screenshot:
  1. From the Add New Project template, select .NET Core and xUnit Test Project (.NET Core) and provide a meaningful name, for example, Chap06_01_Test:
  1. Add folders named Fake and Services. (Refer to ...

Get Building RESTful Web Services with .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.