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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.