Tests in action
So far, we have discussed test strategies and various types of microservice tests. We've also discussed how to test and what to test. In this section, we will see tests in action; we will implement tests with the use of the following:
- Visual Studio 2017 Update 3 or later
- .NET Core 2.0
- C# 7.0
- ASP.NET Core 2.0
- xUnit and MS tests
- The moq framework
Getting ready for the test project
We will test our microservice application: FlixOne bookstore. With the help of code examples, we will see how to perform unit tests, stubbing, and mocking.
Note
We created the FlixOne bookstore application in Chapter 2, Implementing Microservices.
Before we start writing tests, we should set up a test project in our existing application. There are a few simple steps we can take with this test project setup:
- From
Solution Explorer
within Using Visual Studio, right-click onSolution
and clickNew Project—
refer to the following screenshot:

- From the
Add New Project
template select.NET Core
andxUnit Test Project...