Video 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, you 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 will also implement what is learned in real-world N-Tier web applications with .NET 6 and EF Core.
What You Will Learn
- Learn unit testing from scratch
- Learn to set up and use the NUnit and xUnit test framework
- Learn to set up and use the NUnit and xUnit test framework
- 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
Audience
Implement unit testing in N-tier real-world web application project using xUnit
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 necessary in unit testing; you will learn it from scratch in this course.
About The Author
Bhrugen Patel: Bhrugen Patel is a passionate and creative software engineer with a strong focus on simplicity and thorough details. He has been programming since high school and was involved with multiple web and desktop projects using .NET. He has a master’s degree in computer science and a bachelor’s degree in computer engineering. He also has many years of experience with .NET C# and .NET MVC. He enjoys teaching alongside his full-time job.
Table of contents
- Chapter 1 : Introduction to the Course
- Chapter 2 : First Unit Test
-
Chapter 3 : Unit Testing
- Create NUnit Project
- First NUnit Test
- Debug and Assert
- Assignment 1 - Odd Number Checker
- Assignment 1 Solution - Odd Number Checker
- Assertion Model
- Testing multiple values
- Combine Unit Test with Expected Result
- Asserting Doubles
- Asserting String Values
- String Assert Helper Methods
- Asserting Null Values
- Global Initialization for Class
-
Chapter 4 : NUnit Testing – Advance Concepts
- Asserting Collections
- Collections Helper Method
- Range Assert
- Multiple Assert
- Working with Exceptions
- Exceptions without Message
- Set Up Inheritance
- Assert Object Type
- Assignment 2 - Grading Calculator Part 1
- Assignment 2 - Grading Calculator Part 1 Solution
- Assignment 2 - Grading Calculator Part 2
- Assignment 2 - Grading Calculator Part 2 Solution
- Assignment 3 - Fibo Series
- Assignment 3 - Fibo Series Solution
-
Chapter 5 : MOQ with Unit Testing
- Set Up Bank Account Class
- Setting Up Logger Class
- Integration Test Demo
- Unit Test with Fake Logger
- Mocking Overview
- MOQ in Action
- Missing MOQ
- Setting Up LogBook Withdrawal
- MOQ Setup with Conditional Return
- MOQ Setup Default Return Value
- MOQ Evaluate the Return Value
- MOQ and Out Parameters
- MOQ and Ref
- MOQ Default Return Values
- MOQ Properties
- MOQ Callbacks
- MOQ Verification
-
Chapter 6 : xUnit
- Create xUnit Project
- xUnit Comparison
- xUnit Calculator Part 1
- xUnit Calculator Part 2
- Assignment 4 - Grading Calculator
- Assignment 4 - Grading Calculator xUnit Solution
- Assignment 5 - Fibo Series xUnit
- Assignment 5 - Fibo Series xUnit Solution
- MOQ and xUnit
- Customer xUnit
- Assignment 6 - Bank Account xUnit
-
Chapter 7 : Real-World Example - NUnit
- Set Up Main Project
- Bongo Project Code Overview
- Bongo Models Date Checker Part 1
- Bongo Models Date Checker Part 2
- Set Up Data Access Unit Test Project
- In-Memory Database and Unit Testing
- Data Access Unit Tests
- Data Access Unit Tests Bugs and Pitfalls
- Set Up Bongo Core Unit Test Project
- Bongo Core MOQ Setup and GetAllBooking Test
- Bongo Core Exception Unit test
- Bongo Core Save Booking Setup
- Bongo Core Save Booking Unit Test
- Bongo Core Return Code TestCase
- Bongo Core Separating Unit Tests
- Bongo Web Test Project Setup
- Bongo Web Index Action Method Unit Test
- Bongo Web Checking View Name
- Bongo Web Controller Unit Tests
Product information
- Title: Complete Guide to Unit Testing in .NET Core (NUnit and xUnit)
- Author(s):
- Release date: October 2021
- Publisher(s): Packt Publishing
- ISBN: 9781803248660
You might also like
video
ASP.NET Core - SOLID and Clean Architecture (.NET 5 and Up)
Creating a modular, testable, and maintainable application in .NET Core requires a solid foundation. Setting up …
video
The Complete Guide to ASP.NET Core MVC (.NET 6)
This is a beginner to an advanced-level course on .NET 6 that will take you from …
book
ASP.NET Core in Action, Third Edition
Build professional-grade full-stack web applications using C# and ASP.NET Core. In ASP.NET Core in Action, Third …
video
.NET Core Microservices - The Complete Guide (.NET 6 MVC)
In this course, you will learn the foundational elements of microservices by incrementally building a real …