Complete Guide to Unit Testing in NET Core NUnit XUnit

Master unit testing with NUnit, XUnit and MOQ with a real world N-Tier web application (.NET Core 6 and EF Core)
Complete Guide to Unit Testing in NET Core NUnit XUnit
File Size :
2.41 GB
Total length :
5h 9m



Bhrugen Patel


Last update

Last updated 9/2021



Complete Guide to Unit Testing in NET Core NUnit XUnit

What you’ll learn

Learn unit testing from scratch
What unit tests are for and how they are written
How to set up and use the NUnit and XUnit test framework
Run and Debug Unit Tests
Write Mocks with Mocking Framework (MOQ)
Implement unit testing in N-tier real world web application project using XUnit

Complete Guide to Unit Testing in NET Core NUnit XUnit


Basic knowledge of C#
Basic knowledge of .NET Core and EF Core (Basic CRUD application for real world project example)


“Production application can break with a simple change that was unexpected to alter any other functionality” Sounds familiar right?! Good news is, with well written unit test’s this would be a thing of the past.Automated testing has been a buzz word 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 main 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 from developers to know how to write unit tests using best practices. This course will help you setup a solid foundation with a real world example and how unit testing could be done in a .NET Core Web application with EF Core.What is unit testing?UNIT TESTING is a type of software testing where individual units or components of a software are tested. The purpose is to validate that each unit of the software code performs as expected.Why learn unit testing?Why should I learn unit testing? Why spend extra time to write code to test? Is manual testing not sufficient? These are pretty common questions and I will answer them all but most of the times manual testing is much more time consuming and it is not as through as unit test. Unit tests take time once to write and can be executed for free every time! As application grows, the cost of manual testing grows exponentially. And manual testing will never give 100% confidence with all the edge cases.. Automated tests help you to catch the bugs while it is in development phase, because of which they would be easier to resolve. Will it help me with job?Many times, skills comes with that will that skill help me achieve professionally. Unit testing is a very valuable skill with the current development cycle. It is a must have skill in most organizations for senior developers.By end of this course you will have a solid foundation with unit testing. Along with a solid foundation we will implement what we learned in real world N-Tier web application with .NET 6 and EF Core.


Section 1: Introduction

Lecture 1 Welcome

Lecture 2 Manual Testing Overview

Lecture 3 Advantages of automated testing

Lecture 4 Udemy Review

Lecture 5 Tools needed

Lecture 6 Project resources

Lecture 7 Types of test

Lecture 8 Testing pyramid

Lecture 9 Logical phase of an automated test

Section 2: First Unit Test

Lecture 10 Create Project

Lecture 11 Create MSTest Project

Lecture 12 First Unit Test

Lecture 13 Failed Test Example

Section 3: UNit Testing

Lecture 14 Create NUnit Project

Lecture 15 First NUnit Test

Lecture 16 Debug and assert

Lecture 17 Assignment 1 – Odd Number Checker

Lecture 18 Assignment 1 Solution – Odd Number Checker

Lecture 19 Assertion Model

Lecture 20 Testing multiple values

Lecture 21 Combine Unit Test with Expected Result

Lecture 22 Asseting Doubles

Lecture 23 Asserting String Values

Lecture 24 String Assert Helper Methods

Lecture 25 Asserting Null Values

Lecture 26 Global Initialization for Class

Section 4: NUnit Testing – Advance Concepts

Lecture 27 Asserting Collections

Lecture 28 Collections Helper Method

Lecture 29 Range Assert

Lecture 30 Multiple Assert

Lecture 31 Working with Exceptions

Lecture 32 Exceptions without Message

Lecture 33 Setup Inheritance

Lecture 34 Assert Object Type

Lecture 35 Assignment 2 – Grading Calculator Part 1

Lecture 36 Assignment 2 – Grading Calculator Part 1 Solution

Lecture 37 Assignment 2 – Grading Calculator Part 2

Lecture 38 Assignment 2 – Grading Calculator Part 2 Solution

Lecture 39 Assignment 3 – Fibo Series

Lecture 40 Assignment 3 – Fibo Series Solution

Section 5: MOQ with Unit Testing

Lecture 41 Setup Bank Account Class

Lecture 42 Setup Logger Class

Lecture 43 Integration Test Demo

Lecture 44 Unit Test with Fake Logger

Lecture 45 Mocking Overview

Lecture 46 MOQ in Action

Lecture 47 Misuing MOQ

Lecture 48 Setup LogBook Withdrawal

Lecture 49 MOQ Setup with Conditional Return

Lecture 50 MOQ setup default return value

Lecture 51 MOQ evaluate the return value

Lecture 52 MOQ and out parameters

Lecture 53 MOQ and ref

Lecture 54 MOQ default return values

Lecture 55 MOQ Properties

Lecture 56 MOQ Callbacks

Lecture 57 MOQ Verification

Section 6: XUnit

Lecture 58 Create Xunit Project

Lecture 59 XUnit Comparision

Lecture 60 Xunit Calculator Part 1

Lecture 61 Xunit Calculator Part 2

Lecture 62 Assignment 4 – Grading Calculator

Lecture 63 Assignment 4 – Grading Calculator Xunit Solution

Lecture 64 Assignment 5 – Fibo Series XUnit

Lecture 65 Assignment 5 – Fibo Series XUnit Solution

Lecture 66 MOQ and Xunit

Lecture 67 Customer XUnit

Lecture 68 Assignment 6 – Bank Account XUnit

Section 7: Real World Example – NUnit

Lecture 69 Setup Main Project

Lecture 70 Bongo Project Code Overview

Lecture 71 Bongo Models Date Checker Part 1

Lecture 72 Bongo Models Date Checker Part 2

Lecture 73 Setup Data Access Unit Test Project

Lecture 74 In Memory Database and Unit Testing

Lecture 75 Data Access Unit Tests

Lecture 76 Data Access Unit Tests Bugs and Pitfalls

Lecture 77 Setup Bongo Core Unit Test Project

Lecture 78 Bongo Core MOQ Setup and GetAllBooking Test

Lecture 79 Bongo Core Exception Unit test

Lecture 80 Bongo Core Save Booking Setup

Lecture 81 15 Bongo Core Save Booking Unit Test

Lecture 82 16 Bongo Core Return Code TestCase

Lecture 83 17 Bongo Core Seperating Unit Tests

Lecture 84 19 Bongo Web Test Project Setup

Lecture 85 20 Bongo Web Index Action Method Unit Test

Lecture 86 21 Bongo Web checking View Name

Lecture 87 22 Bongo Web Controller Unit Tests

.NET developer who wants to build better quality software with fewer bugs,.NET developer who wants to learn unit testing,.NET developer who wants to see unit testing in real world application

Course Information:

Udemy | English | 5h 9m | 2.41 GB
Created by: Bhrugen Patel

You Can See More Courses in the Developer >> Greetings from

New Courses

Scroll to Top