Cademy logoCademy Marketplace

Course Images

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

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

🔥 Limited Time Offer 🔥

Get a 10% discount on your first order when you use this promo code at checkout: MAY24BAN3X

  • 30 Day Money Back Guarantee
  • Completion Certificate
  • 24/7 Technical Support

Highlights

  • On-Demand course

  • 5 hours 17 minutes

  • All levels

Description

Why should I learn unit testing? Why spend extra time writing code to test? Is manual testing not sufficient? Well, if you have these questions, then you are on the right course. Unit testing is a very valuable skill in the current development cycle. The purpose is to validate that each unit of the software code performs as expected. So, let's dive into it!

'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. All the code files and resource files are added to the GitHub repository at: https://github.com/PacktPublishing/Sparky

What You Will Learn

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

Audience

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

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.

Approach

This is a crisp and comprehensive course that helps you master unit testing with NUnit, xUnit, and MOQ with a real-world N-Tier web application.

The topics are explained in a simple and clear way along with promoting good coding practices. In the end, there is a real-world project where fundamental concepts are implemented for better understanding.

Key Features

A well-designed, comprehensive, and easy-to-understand course on unit testing in .NET Core * Recorded on the latest versions of .NET Core 6 and Visual Studio Code 2022 * Get to know the reason behind different options and why one approach is better than the other

Github Repo

https://github.com/PacktPublishing/Sparky

About the Author

Bhrugen Patel

Bhrugen Patel is a Microsoft MVP and a passionate Software Architect, known for his dedication to simplicity and attention to detail. With a background in programming that dates back to high school, Bhrugen has developed a range of web and desktop applications using .NET. He holds a Master's of Science in Computer Science and a Bachelor's in Computer Engineering, complementing his practical expertise. Alongside his full-time role, Bhrugen is devoted to teaching, driven by a mission to simplify coding and make it accessible. His goal is to alleviate the struggles of students seeking understandable resources. For Bhrugen, coding is not just a profession; it's a means to be creative and enjoy the journey of technological innovation.

Course Outline

1. Introduction to the Course

1. Welcome

This video welcomes you to this course.

2. Manual Testing Overview

This video provides an overview of manual testing.

3. Advantages of Automated Testing

This video shows the advantages of automated testing.

4. Tools Needed

This video helps you with the tools needed for this course.

5. Types of Tests

This video explains different types of tests.

6. Testing Pyramid

This video talks about testing pyramid.

7. Logical Phase of an Automated Test

This video explains the logical phase of an automated test.


2. First Unit Test

1. .NET 6 Update - Nullable

This video talks about the nullable feature in the .NET 6 update.

2. Create Project

This video helps you create your first project.

3. Create MSTest Project

This video demonstrates how to create MSTest project.

4. First Unit Test

This video demonstrates the first unit test.

5. Failed Test Example

This video explains the failed test example.


3. Unit Testing

1. Create NUnit Project

This video helps create the NUnit project.

2. First NUnit Test

This video shows the first NUnit test.

3. Debug and Assert

This video explains how to debug and assert.

4. Assignment 1 - Odd Number Checker

This is an assignment video on the odd number checker.

5. Assignment 1 Solution - Odd Number Checker

This video gives the solution to the assignment on the odd number checker.

6. Assertion Model

This video explains the Assertion model.

7. Testing multiple values

This video demonstrates testing multiple values.

8. Combine Unit Test with Expected Result

This video helps combine a unit test with the expected result.

9. Asserting Doubles

This video explains asserting doubles.

10. Asserting String Values

This video explains how to assert string values.

11. String Assert Helper Methods

This video explores string assert helper methods.

12. Asserting Null Values

This video demonstrates asserting null values.

13. Global Initialization for Class

This video explains global initialization for class.


4. NUnit Testing - Advance Concepts

1. Asserting Collections

This video talks about asserting collections.

2. Collections Helper Method

This video demonstrates about the Collections helper method.

3. Range Assert

This video explains Range assert.

4. Multiple Assert

This video talks about Multiple assert.

5. Working with Exceptions

This video explains how to work with exceptions.

6. Exceptions without Message

This video explains exceptions without a message.

7. Set Up Inheritance

This video demonstrates how to set up Inheritance.

8. Assert Object Type

This video explains the Assert object type.

9. Assignment 2 - Grading Calculator Part 1

This is an assignment video on a grading calculator part 1.

10. Assignment 2 - Grading Calculator Part 1 Solution

This video gives the solution to the assignment on a grading calculator part 1.

11. Assignment 2 - Grading Calculator Part 2

This is an assignment video on a grading calculator part 2.

12. Assignment 2 - Grading Calculator Part 2 Solution

This video gives the solution to the assignment on a grading calculator part 2.

13. Assignment 3 - Fibo Series

This is an assignment video on Fibo series.

14. Assignment 3 - Fibo Series Solution

This video gives the solution to the assignment on Fibo series.


5. MOQ with Unit Testing

1. Set Up Bank Account Class

This video helps set up the bank account class.

2. Setting Up Logger Class

This video shows how to set up the logger class.

3. Integration Test Demo

This video explains how to integrate test demo.

4. Unit Test with Fake Logger

This video explains unit test with a fake logger.

5. Mocking Overview

This video provides an overview of mocking.

6. MOQ in Action

This video shows MOQ in action.

7. Missing MOQ

This video demonstrates the missing MOQ.

8. Setting Up LogBook Withdrawal

This video shows how to set up LogBook withdrawal.

9. MOQ Setup with Conditional Return

This video explains MOQ setup with conditional return.

10. MOQ Setup Default Return Value

This video explains MOQ setup default return value.

11. MOQ Evaluate the Return Value

This video explains MOQ evaluate the return value.

12. MOQ and Out Parameters

This video explains the MOQ and out parameters.

13. MOQ and Ref

This video explains MOQ and ref.

14. MOQ Default Return Values

This video demonstrates MOQ default return values.

15. MOQ Properties

This video demonstrates MOQ properties.

16. MOQ Callbacks

This video explains MOQ callbacks.

17. MOQ Verification

This video talks about MOQ verification.


6. xUnit

1. Create xUnit Project

This video helps create the xUnit project.

2. xUnit Comparison

This video is about xUnit comparison.

3. xUnit Calculator Part 1

This is the first of the two-part video that talks about xUnit calculator.

4. xUnit Calculator Part 2

This is the second of the two-part video that talks about xUnit calculator.

5. Assignment 4 - Grading Calculator

This is an assignment video on grading calculator.

6. Assignment 4 - Grading Calculator xUnit Solution

This video gives the solution to the assignment on grading calculator.

7. Assignment 5 - Fibo Series xUnit

This is an assignment video on Fibo series xUnit.

8. Assignment 5 - Fibo Series xUnit Solution

This video gives the solution to the assignment on Fibo series xUnit.

9. MOQ and xUnit

This video explores MOQ and xUnit.

10. Customer xUnit

This video talks about customer xUnit.

11. Assignment 6 - Bank Account xUnit

This is an assignment video on bank account xUnit.


7. Real-World Example - NUnit

1. Set Up Main Project

This video helps in setting up the main project.

2. Bongo Project Code Overview

This video provides an overview of Bongo project code.

3. Bongo Models Date Checker Part 1

This is the first of the two-part video that talks about Bongo models date checker.

4. Bongo Models Date Checker Part 2

This is the second of the two-part video that talks about Bongo models date checker.

5. Set Up Data Access Unit Test Project

This video helps set up data access unit test project.

6. In-Memory Database and Unit Testing

This video explains in-memory database and unit testing.

7. Data Access Unit Tests

This video explains data access unit tests.

8. Data Access Unit Tests Bugs and Pitfalls

This video explains data access unit tests bugs and pitfalls.

9. Set Up Bongo Core Unit Test Project

This video helps set up Bongo core unit test project.

10. Bongo Core MOQ Setup and GetAllBooking Test

This video explains Bongo core MOQ setup and GetAllBooking test.

11. Bongo Core Exception Unit test

This video explains the Bongo core exception unit test.

12. Bongo Core Save Booking Setup

This video helps set up the Bongo core save booking.

13. Bongo Core Save Booking Unit Test

This video talks about Bongo core save booking unit test.

14. Bongo Core Return Code TestCase

This video explores Bongo core return code TestCase.

15. Bongo Core Separating Unit Tests

This video explains Bongo core separating unit tests.

16. Bongo Web Test Project Setup

This video helps set up the Bongo web test project.

17. Bongo Web Index Action Method Unit Test

This video explains Bongo web index action method unit test.

18. Bongo Web Checking View Name

This video explains Bongo web checking view name.

19. Bongo Web Controller Unit Tests

This video explains Bongo web controller unit tests.

Course Content

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

About The Provider

Packt
Packt
Birmingham
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 i...
Read more about Packt

Tags

Reviews