Implementing C# Unit Testing Using Visual Studio 2019 and .NET 5

by Paul D. Sheriff

Learn how to start unit testing to improve the quality of your applications.

What you'll learn

Every developer knows they should be creating unit tests to improve the quality of their applications. In this course, Basics of Unit Testing for C# Developers, you'll learn how to create unit tests by using Visual Studio.

First, you'll see how easy it is to get started with creating unit tests.
Next, you'll explore how to simplify the unit test process by creating data-driven tests.
Finally, you'll cover how to automate your unit tests by scheduling them to run via the command line utility VSTest.Console.

By the end of this course, you'll have the required skills needed to go on and learn more advanced topics in unit testing.

Table of contents

Course Overview
2mins

Course FAQ

What is Unit Testing in C#?

Unit testing is the process of testing individual units, or components, of source code to ensure that they are working properly. C# unit testing simply means to write unit tests in the C# language, presumably to most fully align with their application code itself.

What is a unit in unit testing?

A unit is essentially the smallest testable part of a software, typically composed of at least one input (sometimes more) and a single output.

What is the best unit test framework for C#?

Three of the top frameworks for unit testing in C# are:

  • MSTest/Visual Studio
  • NUnit
  • xUnit.NET

These are not the only unit testing framework options for C#, but they are widely considered some of the most preferable.

What will I learn in this course?

This C# unit testing course will teach you how to begin unit testing to improve the quality of your applications. Some of the topics covered include:

  • Why you need unit testing
  • Unit testing tools
  • Exception handling in unit tests
  • Initialization and cleanup
  • Unit testing attributes
  • Data-driven testing
  • Automating unit tests
  • Much more
Who should take this course?

This unit testing in C# tutorial is for anyone and everyone who wants to learn how to effectively conduct unit testing in C# to improve the quality of your applications. If you are developing applications in C# then this course is for you!

Are there prerequisites to this course?

As far as unit testing goes, this course is for beginners who are just now learning about the topic. However, you will want to already have a working knowledge of C# programming before taking this course.

About the author

Paul loves teaching and technology, and has been teaching tech and business topics for over 30 years. Paul helps clients develop applications, and instructs them on the best use of technology.

Ready to upskill? Get started