Learn Unit Testing with NUnit and C#
4.5 (22 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
139 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn Unit Testing with NUnit and C# to your Wishlist.

Add to Wishlist

Learn Unit Testing with NUnit and C#

Learn the basics of unit testing and related concepts like mocking that you'll need to build reliable software.
Bestselling
4.5 (22 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
139 students enrolled
Created by Elias Fofanov
Last updated 6/2017
English
Current price: $15 Original price: $40 Discount: 62% off
30-Day Money-Back Guarantee
Includes:
  • 4 hours on-demand video
  • 3 Articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Write Unit Tests
  • Run and Debug Unit Tests
  • Write Manual Mocks
  • Write Mocks with Mocking Framework
  • Practice Test-Drived Development (TDD)
  • Apply Best Practices of Writing Unit Tests
View Curriculum
Requirements
  • You should already be familiar with the basics of C#
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 esteem your time. The course material is succinct, yet comprehensive. All important concepts are covered. Particularly important topics are covered in-depth. For absolute beginners, I offer my help on Skype absolutely free, if requested.

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 basic features
  • Test Doubles including fakes, dummies, stubs, spies and mocks
  • How to write manual test doubles and how to use a mocking framework
  • TDD, red-green-refactor triplet
  • A great number of best practices of writing unit tests

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 4 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#

Who is the target audience?
  • Beginners who want to write better code
  • Anyone who is interested in Unit Testing
Curriculum For This Course
54 Lectures
04:09:18
+
Getting Started
12 Lectures 37:29
How to Ask Questions
00:23

Download Source Code and Slides
00:03

The outline of the first section on the essentials of Unit Testing in .NET.

Preview 00:58

Learn what is a unit test in essence.

What is a Unit Test?
03:11

Learn what is a unit testing framework, which frameworks exist and is it so important to stick with a specific one?

Unit-Testing Frameworks
03:25

Write your first unit test in Visual Studio in C# and NUnit unit testing framework.

Your First Unit Test
08:43

Learn what naming conventions regarding unit test classes, unit tests and unit testing projects exist.

Naming Conventions
04:34

Learn how to run and debug unit tests in Visual Studio.

Running and Debugging Unit Tests
05:02

Learn what benefits do unit tests provide.

Benefits of Unit Testing
03:35

In this lecture, we will answer the question about who should write unit tests? Programmers or maybe testers?

Who Should Write Unit Tests and When
02:51

Learn the Oath of Programmers.

Preview 03:29

The conclusion of the first section on essentials of unit testing.

Conclusion
01:15
+
NUnit Framework
11 Lectures 35:42

The outline of the second section on basics on NUnit unit testing framework.

Outline
01:06

Learn the basics of Assertions in unit tests.

Preview 05:29

Learn how to write assertions with NUnit on practice.

Assert Demo
10:27

Learn the Arrange-Act-Assert triplet.

Arrange-Act-Assert
01:01

Learn how to run unit tests from the Console.

Running Tests from the Console
01:51

Learn how to use special attributes of NUnit: SetUp and TearDown.

SetUp and TearDown
04:50

Learn how to use special attributes of NUnit: OneTimeSetUp and OneTimeTearDown.

OneTimeSetUp and OneTimeTearDown
02:13

Learn how to write parameterized unit tests with NUnit.

Prameterized Unit Tests
03:11

Learn how to group and ignore unit tests with NUnit.

Preview 02:14

Learn what is Code Coverage in unit testing.

Code Coverage
01:42

The conclusion of the second section on the essentials of the NUnit unit testing framework.

Conclusion
01:38
+
Test Doubles
11 Lectures 01:05:33

The outline of the third section on essentials of test doubles in unit testing.

Outline
01:09

Demonstration of a case when it's hard to unit test the logic.

Preview 03:43

Demo of how to refactor bad code to make it testable.

Refactoring to Make Code Testable
04:19

Learn the different types of test doubles such as mock, stub, spy, fake, dummy,

Preview 05:55

Learn how to write test doubles manually, without using any mocking framework.

Hand Rolled or Manual Test Doubles
11:53

Learn the problems related to writing manual test doubles.

Problems with Manual Test Doubles
01:16

Learn what is a mocking framework, which exist and which one to pick.

Mocking Frameworks
07:46

Learn how to write a unit test with test doubles powered by a mocking framework.

Writing Unit Tests with a Mocking Framework
07:45

Learn the main features of NSubstitute mocking framework.

NSubstitute Mocking Framework. Key Features. Demo
18:06

Learn the difference between Detroit School and London School of Unit Testing.

Detroit School vs London School of Unit Testing
02:23

The conclusion of the third section on the essentials of mocking frameworks.

Conclusion
01:18
+
Test-Driven Development
6 Lectures 45:22

The outline of the fourth section on essentials of Test-Driven Development.

Outline
00:41

Learn what is TDD.

What is TDD?
05:00

Learn Red\Green\Refactoring process of TDD.

Red \ Green \ Refactor
04:16

Learn what is the difference between Design Upfront and TDD.

TDD and Design Upfront
02:35

The demonstration of TDD on the example of programming a simple console game.

TDD Demo
32:16

The conclusion of the fourth section on essentials of TDD.

Conclusion
00:34
+
Best Practices of Unit Testing
14 Lectures 01:04:36

Outline of the fifth section on best practices of unit testing.

Outline
00:55

In this lecture we will answer the question "Do Unit Tests Guarantee the Success?"

Do Unit Tests Guarantee the Success?
02:25

Learn what is pragmatic unit testing.

Pragmatic Unit Testing
05:16

Learn what are integration tests.

Integration Tests
04:18

Learn what is a singleton design pattern and how it damages the ability to write unit tests.

Singletons and Static Classes
07:02

Learn about the smell of header interfaces. They very often appear when we introduce them just for the sake of writing mocks.

Header Interfaces
05:56

Demo of a refactoring of untestable code to the state when it is testable (when we can write unit tests).

Demo of Refactoring to a Testable Design
14:29

Learn how much test coverage is enough.

How Much Test Coverage is Enough?
02:37

Do we need to write unit tests for trivial code?

Preview 02:59

Learn what really means the rule of a Single Concern in a single unit test.

The Rule of Testing a Single Concern
03:06

Learn more about general best practices of writing unit tests.

More on Best Practices
10:19

Learn how to easily generate signatures of unit test methods.

Preview 01:25

Conclusion of the fifth section on the best practices of writing unit tests.

Conclusion
02:31

Final Quiz
14 questions

BONUS LECTURE
01:18
About the Instructor
Elias Fofanov
4.3 Average rating
628 Reviews
4,029 Students
7 Courses
Software Engineer

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.

"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.