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

Learn how to start unit testing to improve the quality of your applications.
Course info
Rating
(148)
Level
Beginner
Updated
Feb 16, 2021
Duration
2h 12m
Table of contents
Course Overview
Why You Need Unit Testing
Your First Unit Tests
Avoid Hard-Coding in Unit Tests
Initialization and Cleanup
Attributes Help You Organize Your Unit Tests
Assert Classes Save a Lot of Time
Consolidate Tests by Making Them Data-Driven
Automating Unit Tests with VS.Test.Console
Description
Course info
Rating
(148)
Level
Beginner
Updated
Feb 16, 2021
Duration
2h 12m
Description

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.

Course FAQ
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
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.

More from the author
C# Language-Integrated Query (LINQ)
Intermediate
2h 32m
Mar 17, 2021
Working with XML in C#
Intermediate
1h 48m
Feb 2, 2021
More courses by Paul D. Sheriff
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello, my name is Paul Sheriff, and welcome to my course, Implementing C# Unit Testing using Visual Studio 2019 and .NET 5. I am a business IT consultant at PDS Consulting with over 34 years of experience creating enterprise applications. Every developer needs to test their code or have it tested by someone. Most developers are not great at testing their own code, and this is where unit testing can really help. Learning to create unit tests will improve your code quality, make your end users happier, and will actually make you a better programmer. Some of the major topics you will learn in this course are why you need unit testing; your first unit tests; avoid hard coding, initialization and cleanup; attributes to help you organize your tests, assert classes save a lot of time; consolidate tests by making them data driven; and automating unit tests with a command‑line utility. By the end of this course, you will have the required skills needed to go on and learn more advanced topics in unit testing with some of the other great courses in the Pluralsight library. Before beginning this course, you should be familiar with C# and Visual Studio. I hope you'll join me on your mission to becoming a great programmer by employing unit tests as a part of your development cycle in my course, Implementing C# Unit Testing with Visual Studio 2019 and .NET 5, at pluralsight.com.