The TestContext Class

The unit test framework contains a class that is used to store information pertaining to executing tests. This class is called TestContext. You use the properties of this class to get information about your running tests, including the path to the test directory, a URL to the executing test (in the case of ASP.NET unit tests), and data-binding information such as the data connection or the current row of data for the executing test class. There are also a couple useful methods of this class for things like writing trace messages. The test context information is stored inside properties of this class. The key properties and methods are defined inside Table 8.1.

TABLE 8.1 TestContext Key Properties and Methods

TestContext ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.