Advanced Unit Testing C# Code with NUnit and Moq - Part 1
4.1 (49 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
4,722 students enrolled

Advanced Unit Testing C# Code with NUnit and Moq - Part 1

Learn basics of unit testing, NUnit and Moq frameworks, unit testing asynchronous and multithreaded code.
4.1 (49 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
4,722 students enrolled
Created by Mustafa Kök
Last updated 10/2019
English
English [Auto-generated]
Current price: $13.99 Original price: $19.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 1.5 hours on-demand video
  • 6 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Basics of unit testing with NUnit and Moq frameworks.
  • Unit testing async methods.
  • Unit testing timers.
  • Unit testing threads.
Course content
Expand all 31 lectures 01:32:05
+ Unit Testing Async Code
7 lectures 19:56
Methods That Return Void and Task
06:38
Method That Returns Task<T>
02:24
Async Task<T> Methods
01:43
Exceptions in Methods That Return Task
04:43
Exceptions in Async Task Methods 1
01:46
Exceptions in Async Task Methods 2
00:52
Exceptions in Async Void Methods
01:50
+ Timers
6 lectures 10:23
Introduction
00:56
Bad Way with Thread.Sleep
01:44
Internal Methods
01:19
Callback Interface
02:22
Humble Object
01:08
Using Abstractions
02:54
+ Simple Threads
6 lectures 11:20
Introduction
00:47
Internal Methods
01:29
Using Events
02:00
Callback Interface
01:44
Humble Object
01:13
Custom TaskScheduler
04:07
+ Manually Created Threads That Has Loops
4 lectures 07:29
Introduction
01:40
Internal Methods
01:34
Humble Object
01:22
Using Abstractions
02:53
Requirements
  • Familarity with unit testing and NUnit framework.
Description

Unit tests are written to test small parts (units) of the code. Properly written unit tests help us find bugs at a very early stage of the development process. Ability write good, functional unit tests is expected from developers for almost all development tasks.

NUnit is a very popular unit testing framework used by C# developers. Since we need to isolate the code block in order to test it, we sometimes need to prepare fake implementations for the dependencies that tested code block uses. These fake implementations are generally called "test doubles". Moq is another popular framework used to create automatic "test doubles" in a unit test.

This course starts with unit testing, test-double basics and includes introductory level lessons for NUnit and Moq frameworks that are just enough for you to start using them. You can learn more about them from the resources provided at the end of each section.

Writing unit tests for ordinary classes and methods are mostly easy. But there are some methods and classes that need special attention while writing unit tests. Asynchronous and multithreaded operations are two examples to them.

This course suggests different ways for testing asynchronous, multithreaded operations and timers.

I hope you enjoy the course.


Who this course is for:
  • C# Developers that want to learn unit testing special cases and classes.