Learn Unit Testing with NUnit and C# (Udemy.com)
Learn unit testing, TDD, mocking and Dependency Injection: techniques that you'll need to build reliable software.
Created by: Engineer Spock
Last updated July 2020
What you will learn
- Write Unit Tests
- Run and Debug Unit Tests
- Write Manual Mocks
- Write Mocks with Mocking Framework
- Practice Test-Driven Development (TDD)
- Apply Best Practices of Writing Unit Tests
How it compares
Against the other 194 rated Udemy courses in C# on CourseDuck:
- Rating4.4 out of 5higher than 38% of them
- Reviews1,872#38 of 195 by number of reviews
- Length7.7 hourslonger than 61% of them
- Last updatedJuly 2020earlier than 61% of them
Course Description
Learn deeply the concepts and tools that you will need to build maintainable and reliable software.
Teaching Approach
No fluff, no ranting, no beating the air. I respect your time. The course material is succinct, yet comprehensive. All important concepts are covered. Particularly important topics are covered in-depth.
Take this course, and you will be satisfied.
Build a solid foundation in Unit Testing with this course
This course is all about writing effective unit tests using C# programming language and NUnit 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 including all the most important topics such as mocking and test driven development (TDD in short). This course does not cover all the features of NUnit. This course is way more interesting.
Learning unit testing puts a powerful and very useful tool at your fingertips. Being familiar with unit testing you can write reliable and maintainable applications. It is very hard to lead a project which is not covered by unit tests.
Content and Overview
This course is primarily aimed at beginner developers. It provides solid theoretical base reinforced by tons of practical material.
We start with basics of unit testing. What is a unit test? What unit testing frameworks exist? How to run and debug unit tests. After getting acquainted with the basics, we will get to the NUnit framework. Here you’ll learn how to install the framework, set the runner. Then you’ll learn the basics of assertions and arrange-act-assert triplet. Other key features of NUnit are also covered:
Running tests from the console
Setup and teardown unit tests
Parameterized tests
Grouping and ignoring
Practicing writing of unit tests, it’s impossible to avoid applying mocks. I like the word “test double” more, in general. By the way, you’ll learn what the difference between the following notion is:
Test double
Fake
Dummy
Stub
Mock
You’ll learn how to write test doubles manually. You will also see a simple example of how to use a mocking framework for using mocks. I’ll use NSubstitute mocking framework for demonstration.
At the end of this section, you’ll get acquainted with two key approaches to unit testing, Classic or Detroit School and London School of unit testing.
You’ll separately learn the basic of test-driven development. It is hard to imagine a modern professional developer who doesn’t know about TDD, so you’ll learn what it is and what it is about. You’ll see the Red-Green-Refactor triplet in action.
I could not complete the course avoiding the best practices of writing unit tests. You’ll learn the basic concepts of the modern approach to unit testing called “pragmatic unit testing”. You’ll see what problems static classes and singletons bring regarding the unit testing. They make code harder to unit test. After that, you’ll learn the problem of extracting interfaces just for the sake of introducing shims for injecting dependencies.
You’ll know should you write unit tests for the trivial code. You’ll learn a lot more in the course.
So, in short, the course covers the following topics:
Basic notions of Unit Testing
NUnit and its features
Test Doubles including fakes, dummies, stubs, spies and mocks
How to write manual test doubles and how to use a mocking framework (NSubstitute)
TDD, red-green-refactor triplet
A great number of best practices of writing unit tests
Introduction to Dependency Injection
In the end, we will recap what you have learned, and you will try to understand where you have to go further with the intention to master your skills.
How long is this course: The course is around 7.5 hours. All are video lectures. You will be able to download all the slides and code samples used in the course.
------------------------------------------------------------
Keywords related to the course:
Visual Studio unit testing tutorial
NUnit unit testing tutorial
Dot Net testing framework
C# unit test framework
Visual Studio unit testing framework tutorial
csharp unit testing tutorial
TDD in C#
NSubstitute
TDD
Test Driven Development
unit testing C#
Instructor Details
- 4.4 Rating
1,872 Reviews
Engineer Spock
I'm thankful enough for that I love what I do.
I began my career as a postgraduate student participating in Microsoft ImagineCup contest.
I've been working with .NET platform since 2003. I've been professionally architecting and implementing software for nearly 7 years, primarily based on .NET platform. I'm passionate about building rich and powerful applications using modern technologies. I'm a certified specialist in Windows Applications and Service Communication Applications by Microsoft. I'm one of the coordinators of the MSK.NET User Group in Moscow.
"If it's work, we try to do less. If it's art, we try to do more." - Seth Godin.
What I can say is that software is my art.
More courses by Engineer Spock
Algorithms and Data Structures in C#: Complete Tutorial (2026)
4.6 (2,310 Reviews)
Provider: Udemy
Time: 18.5h
$64.99
Learn Enterprise WPF with XAML from Scratch (2020)
4.1 (1,503 Reviews)
Provider: Udemy
Time: 5.1h
$11.99
Software Architecture: Meta and SOLID Principles in C# (2020)
4.3 (1,310 Reviews)
Provider: Udemy
Time: 4.8h
$11.99
Master the Art of Writing Clean Code in C# (2020)
4.5 (1,231 Reviews)
Provider: Udemy
Time: 7.2h
$79.99
API in C#: The Best Practices of Design and Implementation (2020)
4.1 (1,108 Reviews)
Provider: Udemy
Time: 3.4h
$11.99
More C# courses
C# Developers: Double Your Coding Speed with Visual Studio (2018)
4.7 (4,035 Reviews)
Provider: Udemy
Time: 2.2h
$13.99
Object Oriented Programming with C# - Beginner to Advanced (2020)
4.7 (2,063 Reviews)
Provider: Udemy
Time: 5.6h
$64.99
Learn Game Development with C# Programming and MonoGame! (2025)
4.7 (1,094 Reviews)
Provider: Udemy
Time: 6.6h
$12.99
Reviews
By Anonymized User on 2/24/2023
This is a very clear and thorough explanation of unit testing and TDD. I found it helpful to follow along with the code examples, but sometimes the code being demonstrated in the video depended on classes that were not shown. It would be nice to have more of these example projects available for download.
By Jacob Humphrey on 5/12/2020
Knowledgeable, but not up to date in some aspects such as how to get VS set up. I had significant trouble getting the NUnit set up with newer versions of VS. The teacher also mentions complex or confusing things and doesn't explain what he means or goes too fast. A lot of the Videos are short, but it makes it harder to find help for specific confusions as he doesn't go into great detail very often and explains things like we should already know what he means.
By Sebastian Hempel on 6/17/2019
I am very satisfied with the course. I especially liked the practical exercises. They are kept simple to check only the current topic. The course is clearly structured: 1. clear Agenda 2. short theoretical part 3. few practical examples 4. an own exercise 5. what has been learned This is repeated in loops in a course.
By Kofi Oghenerukevwe on 2/11/2019
I enjoyed the course, it was direct and to-the-point. No fluff. I like that it presented multiple perspectives on unit testing as a software engineering practice and in doing so, made me aware of the fact that in engineering, there are no easy answers. There are some opportunities for practice, but not enough (that's an area that can be improved).
By Joyce on 1/23/2018
Great course, I don't have advanced knowledge of C# but I was able follow along. The explanations and examples are great and easy to understand. I would definitely recommend this course as the lecturer Elias really knows his stuff. Thanks so much Elias, this really helped me understand the basics, I will definitely look at your other courses!
By Mitchel Anderson on 12/5/2017
Don't let the dry tone with which Elias speaks throw you off, this is a well done and interesting course. Elias (Engineer Spock) walks you through each section with clear and simple examples. Each lesson builds on the previous lesson and within a short time I had a clear picture of complex unit testing concepts including Mocking and TDD.
By Christopher Scott on 9/19/2017
Instructor is good and gets a cross a lot of information, however I think there needs to be more hands on exercises. E.G. on the sticks game section this seemed very rushed and there was no real guidance. If instead you outlined the task ahead e.g. we need to write a test to do xxx you could write the first test to show a general way of doing but on the next test just say write a test for xxx tell us to pause the video and then show us how you did it and we could compare. maybe then mix it up write a test then ask us to write the code to pass the test. I have enjoyed the course so far and learned a lot but I think this section needs a lot of improvement and could enhance the learning experience we a view changes.
By Steven Shaw on 8/31/2017
The best practices and other advice provided were invaluable, thanks! They really help in providing focus and outline for the unit test development effort. The "watch and learn" live coding examples were less helpful for me personally. The view changed way too fast for me to keep up in order to comprehend.
By Shabana Parveen on 7/7/2017
No doubt about expertise of tutor however there are places where I found bit difficult to understand. For example explanation regarding why singleton and static class are difficult to test could have been explained with basic code rather than real time implementation then proceed towards real world implementation. It would have helped. However, this is a very useful tutorial. Thank you.
By Pierre Gadea on 6/10/2017
A very informative course on Unit Testing with NUnit and .NET. It's not a code-along course or project based, in case someone is looking for that. Adding lessons for testing mapped models (AutoMapper) and maybe NBuilder or another builder would be a nice touch. Also, testing web apps would be more interesting. Course title is accurate and lessons are helpful.
Quality Score
No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.
Overall Score : 88 / 100












