About This Course

Learn why unit testing is important.


Industry, employers, startups, and developers are increasingly looking towards unit testing their software. This definitive trend is not without reason. Unit testing is one of the most reliable ways to find and keep software bugs at bay, therefore reducing costs and development pains. Developers working with the .NET framework are overwhelmingly turning to NUnit to meet their unit testing needs.

In this interactive course, you’ll learn the principles of unit testing step by step. Additionally, you’ll learn to configure and use the NUnit testing framework. Given that the course places emphasis on principles, these skills are transferable to other unit testing frameworks.

Along with teaching the principles, this course also emphasizes designing tests in the NUnit framework. We’ll do so with extensive and detailed coverage of various topics, such as the unit test structure, assertions, and test cycles.

Course prerequisites

The course is designed to minimize the amount of prerequisites. The following skills and knowledge are required to successfully complete this course:

  • C# programming
  • Object-oriented design
  • Basic familiarity with the Visual Studio Integrated Development Environment (IDE) - Should you wish to run course exercises on your machine.

Although not required, some working knowledge of ASP.NET web-based applications may prove beneficial towards the end of the course.

Interacting with course exercises

This course adopts a text-first approach with regards to content. Numerous single-page applications (SPA) supplement the text. These single-page applications are able to run the code that you type into them. You may change the code in a SPA to better understand a certain concept.

SPAs are beneficial because you don’t need to do the following:

  • Set up your local development environment
  • Flip between your local environment and the course

When running tests inside a SPA, you only need to click the “Run” button and observe the output of the test in the console output.

However, setting up your own environment is recommended because running tests within the SPA is slower compared to working on your own machine. This is especially important if you are working on a challenge and need to incrementally run your tests to see if they are working as expected. Furthermore, your local environment may identify compile-time errors, speeding up your code-test-fix-test cycle.

For instructions on how to set up your local environment, go to the “Setting up a NUnit Project” lesson in the appendix.

Course layout

  1. Fundamentals of Unit Testing: This section outlines what unit testing is, why it is important, and how to run a minimal unit test.
  2. Testing Conditions with Classic and Fluent Assertions: This section provides an assertion vocabulary so that you may design basic tests.
  3. Making Unit Testing More Effective: This section provides the tools and techniques to reduce redundancy in your unit test code.
  4. Unit Testing Code with External Dependencies: This section provides guidance on how to test code that is tightly coupled with other code.
  5. Conclusion: This section provides a summary of the most important unit testing topics as well as their formal definitions and associated resources.
  6. Appendix: This section supplements the core lessons with theoretical topics and environment setups.