We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Creating Unit Tests

This section provides instructions about how to create unit tests, gives some background information about how to test methods that have restricted access, and describes the various assert classes that you can use in unit tests.

How to: Create and Run a Unit Test

Describes how to create a unit test by using the Visual Studio Team System testing tools.

How to: Create a Unit Test without Source Code

Describes how to create a unit test for an .EXE or a .DLL for which you do not have access to the source code.

How to: Create a Data-Driven Unit Test

Describes how to create a data-driven unit test.

Unit Tests for Private, Internal, and Friend Methods

Describes how the testing tools provide unit tests with the ability to access internal, private, and friend methods even though they are in a separate class.

Using the Assert Classes

Describes the various kinds of assert statements that you can use in unit tests for purposes such as comparing values or collections or checking for specific test results.

Using Publicize to Create Private Accessors

Describes how to use private accessors by using Publicize.

Coding Custom Unit Tests Using the Unit Testing Framework

Overview of the Microsoft.VisualStudio.TestTools.UnitTesting namespace that is used to create custom unit tests.