Complete Guide to Unit Testing in .NET Core (NUnit and xUnit)

person icon Packt Publishing

Complete Guide to Unit Testing in .NET Core (NUnit and xUnit)

Master unit testing with NUnit, xUnit, and MOQ with a real-world N-Tier web application with the latest version of .NET Core 6 and EF Core

updated on icon Updated on Sep, 2023

language icon Language - English

person icon Packt Publishing

architecture icon IT & Software,Software Testing


30-days Money-Back Guarantee

Training 5 or more people ?

Get your team access to 19,000+ top Tutorialspoint courses anytime, anywhere.

Course Description

"Production application can break with a simple change that was unexpected to alter any other functionality." Sounds familiar, right?

The good news is, with well-written unit tests this would be a thing of the past.

Automated testing has been a buzzword for a while, but many times developers struggle to find a course that covers the fundamentals of unit testing while implementing what they learned in a real-world project! That is the focus of this course.

This course is all about writing effective unit tests using C# programming language and NUnit / XUnit as a unit testing framework. Along the way, we will learn the concepts related to unit testing. Today unit testing is an absolutely required skill from any professional developer. Companies expect developers to know how to write unit tests using the best practices. This course will help you set up a solid foundation with a real-world example and how unit testing could be done in a .NET core web application with EF Core.

By the end of this course, you will have a solid foundation with unit testing. Along with a solid foundation, you’ll also implement what is learned in real-world N-Tier web applications with .NET 6 and EF Core.

All the code files and resource files are added on the GitHub repository at https://github.com/PacktPublishing/Sparky


This course is designed for the .NET developer who wants to build better quality software with fewer bugs. This will also help them to learn unit testing from scratch and reinforce their fundamental learning with real-world application.


What will you learn in this course:

  • Learn unit testing from scratch.
  • Learn to set up and use the NUnit and xUnit test framework.
  • Write mocks with Mocking Framework (MOQ).
  • Explore unit tests and how they are written.
  • Run and debug unit tests.
  • Implement unit testing in N-tier real-world web application project using xUnit.


What are the prerequisites for this course?

  • Basic knowledge of C# along with .NET Core and EF Core is required to gain the most out of this course. No prior experience is required in unit testing at all, you will learn it from scratch in this course.
Complete Guide to Unit Testing in .NET Core (NUnit and xUnit)


Check out the detailed breakdown of what’s inside the course

Introduction to the Course
7 Lectures
  • play icon Welcome 03:04 03:04
  • play icon Manual Testing Overview 01:39 01:39
  • play icon Advantages of Automated Testing 01:01 01:01
  • play icon Tools Needed 00:49 00:49
  • play icon Types of Tests 02:02 02:02
  • play icon Testing Pyramid 02:15 02:15
  • play icon Logical Phase of an Automated Test 01:53 01:53
First Unit Test
4 Lectures
Unit Testing
13 Lectures
NUnit Testing – Advance Concepts
14 Lectures
MOQ with Unit Testing
17 Lectures
11 Lectures
Real World Example - NUnit
20 Lectures

Instructor Details

Packt Publishing

Packt Publishing

Founded in 2004 in Birmingham, UK, Packt's mission is to help the world put software to work in new ways, through the delivery of effective learning and information services to IT professionals.

Working towards that vision, we have published over 6,500 books and videos so far, providing IT professionals with the actionable knowledge they need to get the job done - whether that's specific learning on an emerging technology or optimizing key skills in more established tools.

As part of our mission, we have also awarded over $1,000,000 through our Open Source Project Royalty scheme, helping numerous projects become household names along the way.

Course Certificate

User your certification to make a career change or to advance in your current career. Salaries are among the highest in the world.

sample Tutorialspoint certificate

Our students work
with the Best

Related Video Courses

View More

Annual Membership

Become a valued member of Tutorials Point and enjoy unlimited access to our vast library of top-rated Video Courses

Subscribe now
People having fun around a laptop

Online Certifications

Master prominent technologies at full length and become a valued certified professional.

Explore Now
People having fun around a laptop

Talk to us