Unit Testing in Visual Studio


Course Description

This two-day, instructor-led course provides students with the knowledge and skills to effectively use Visual Studio to design, write, and run high-quality .NET unit tests. The course focuses on the applicable features and capabilities of Visual Studio as it relates to unit testing and Test-Driven Development. This course also introduces other popular unit testing tools and techniques, and demonstrates how they integrate with Visual Studio and your team’s development lifecycle.

Duration: 3 days


Unit Testing in .NET

What is (and isn’t) a unit test Why write unit tests .NET unit testing frameworks MSTest V2, NUnit, xUnit The anatomy of a unit test Writing and running your first unit test

Unit Testing in Visual Studio

Testing support in Visual Studio MSTest, NUnit, and xUnit test projects Test Explorer and other windows Writing and running unit tests in Visual Studio Managing a large number of tests and test results Organizing tests by grouping, filtering, and playlists Continuous testing in Visual Studio

Test-Driven Development (TDD)

TDD overview and benefits Practicing TDD within Visual Studio Effectively refactoring code Working with legacy code Using CodeLens to support TDD and refactoring

Writing Good Unit Tests

Asking questions about your code Path testing (e.g. happy, sad, evil, etc.) Right BICEP testing Testing for expected exceptions Maintaining high-quality test code Unit test naming conventions (e.g. BDD) Organizing unit tests

Leveraging Visual Studio

Analyzing code coverage Using code coverage as a metric Parameterized (data-driven) unit tests DataRow, DynamicData, and DataSource attributes Concurrent testing using Live Unit Testing Concurrent testing using NCrunch

Testing Difficult Code

The need to isolate code under test Doubles (dummies, stubs, fakes, and mocks) Microsoft Fakes framework (stubs and shims) Comparing mocking frameworks Using Rhino Mocks and NSubstitute frameworks Profiling slow running unit tests Using IntelliTest with legacy code


Unit testing Visual Studio Microsoft Visual Studio 2019 .net TDD Test Driven Development Software Testing