Skip to Main Content
.NET Core 2.0 By Example
book

.NET Core 2.0 By Example

by Neha Shrivastava, Rishabh Verma
March 2018
Beginner to intermediate content levelBeginner to intermediate
458 pages
10h 34m
English
Packt Publishing
Content preview from .NET Core 2.0 By Example

Testing using xUnit

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:

  1. Open the Let's Chat project in Visual Studio 2017
  2. Create a new folder named  Test
  3. Right-click the Test folder and click Add | New Project
  4. Select xUnit Test Project (.NET Core) under Visual C# project templates, as shown here:
  1. Delete the default test class that gets created with the template
  2. Create a test class inside this project  ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET Core 3 and React

ASP.NET Core 3 and React

Carl Rippon
Enterprise Application Development with C# 9 and .NET 5

Enterprise Application Development with C# 9 and .NET 5

Ravindra Akella, Rishabh Verma, Arun Kumar Tamirisa, Suneel Kumar Kunani, Bhupesh Guptha Muthiyalu

Publisher Resources

ISBN: 9781788395090Supplemental Content