Share via


Microsoft.VisualStudio.TestTools.UnitTesting Namespace

The Microsoft.VisualStudio.TestTools.UnitTesting namespace supplies classes that provide unit testing support. This namespace contains many attributes that identify test information to the test engine regarding data sources, order of method execution, program management, agent/host information, and deployment data. The Microsoft.VisualStudio.TestTools.UnitTesting namespace also contains custom unit testing exceptions.

Classes

  Class Description
Public class AfterAssemblyCleanupEventArgs Provides data for the AfterAssemblyCleanup event.
Public class AfterAssemblyInitializeEventArgs Provides data for the AfterAssemblyInitialize event.
Public class AfterClassCleanupEventArgs Provides data for the AfterClassCleanup event.
Public class AfterClassInitializeEventArgs Provides data for the AfterClassInitialize event.
Public class AfterTestCleanupEventArgs Provides data for the AfterTestCleanup event.
Public class AfterTestInitializeEventArgs Provides data for the AfterTestInitialize event.
Public class AssemblyCleanupAttribute Identifies a method that contains code to be used after all tests in the assembly have run and to free resources obtained by the assembly. This class cannot be inherited.
Public class AssemblyInitializeAttribute Identifies a method that contains code to be used before all tests in the assembly have run and to allocate resources obtained by the assembly. This class cannot be inherited.
Public class Assert Verifies conditions in unit tests using true/false propositions.
Public class AssertFailedException Used to indicate failure for a test.
Public class AssertInconclusiveException Used to indicate that a test is not yet implemented.
Public class BaseShadow This class is used by the publicize method to help test private types.
Public class BeforeAssemblyCleanupEventArgs Provides data for the BeforeAssemblyCleanup event.
Public class BeforeAssemblyInitializeEventArgs Provides data for the BeforeAssemblyInitialize event.
Public class BeforeClassCleanupEventArgs Provides data for the BeforeClassCleanup event.
Public class BeforeClassInitializeEventArgs Provides data for the BeforeClassInitialize event.
Public class BeforeTestCleanupEventArgs Provides data for the BeforeTestCleanup event.
Public class BeforeTestInitializeEventArgs Provides data for the BeforeTestInitialize event.
Public class ClassCleanupAttribute Identifies a method that contains code to be used after all the tests in the test class have run and to free resources obtained by the test class. This class cannot be inherited.
Public class ClassInitializeAttribute Identifies a method that contains code that must be used before any of the tests in the test class have run and to allocate resources to be used by the test class. This class cannot be inherited.
Public class CollectionAssert Verifies true/false propositions associated with collections in unit tests.
Public class CssIterationAttribute Represents the project iteration to which this test corresponds. This class cannot be inherited.
Public class CssProjectStructureAttribute Represents the node in the team project hierarchy to which this test corresponds.
Public class DataSourceAttribute Provides data source-specific information for data-driven testing. This class cannot be inherited.
Public class DataSourceElement Represents a data source element as an XML tag within a configuration file.
Public class DataSourceElementCollection Represents an XML element that contains a collection of child DataSourceElement objects.
Public class DeploymentItemAttribute Specify a file or directory that should be deployed along with the assemblies before running a test. Attach this attribute to a test class or test method. You can use multiple instances. This attribute is not inherited.
Public class DescriptionAttribute Used to specify the description of the test. This class cannot be inherited.
Public class ExpectedExceptionAttribute Indicates that an exception is expected during test method execution. This class cannot be inherited.
Public class ExpectedExceptionBaseAttribute This is a base class for attributes that specify to expect an exception from a unit test.
Public class GenericParameterHelper This class is a placeholder for use with generics. It helps you test generic types by letting you pass non-specific type arguments.
Public class HostTypeAttribute Specifies the type of host on which the associated unit test will run. This class cannot be inherited.
Public class IgnoreAttribute Indicates that a specific test should not be run. This class cannot be inherited.
Public class InternalTestFailureException The exception that is thrown to indicate an internal failure for a test.
Public class OnTestStoppingEventArgs Occurs when a test is stopped before it is completed.
Public class OwnerAttribute Used to specify the person responsible for maintaining, running, and/or debugging the test. This class cannot be inherited.
Public class PriorityAttribute Used to specify the priority of a unit test. This class cannot be inherited.
Public class PrivateObject Allows test code to call methods and properties on the code under test that would be inaccessible because they are not public.
Public class PrivateType Represents the type of a private class that gives access to private static implementations.
Public class ShadowingAttribute Do not use this class.
Public class StringAssert Verifies true/false propositions associated with strings in unit tests.
Public class TestCategoryAttribute Class that is used to specify the category of a unit test.
Public class TestCategoryBaseAttribute Provides a base class for the Category attribute.
Public class TestClassAttribute Used to identify classes that contain test methods. This class cannot be inherited.
Public class TestClassExtensionAttribute Activates a class so that it is recognized as a Unit Test extension class.
Public class TestCleanupAttribute Identifies a method that contains code that must be used after the test has run and to free resources obtained by all the tests in the test class. This class cannot be inherited.
Public class TestConfiguration Provides access to a TestConfigurationSection that represents the microsoft.visualstudio.testtools section in an app.config file.
Public class TestConfigurationSection Provides access to data source configuration data.
Public class TestContext Used to store information that is provided to unit tests.
Public class TestExecution This class represents events that are related to test execution.
Public class TestExecutionEventArgs Base class for events in the TestExecution class.
Public class TestExtensionExecution This class enables the customized execution of tests.
Public class TestInitializeAttribute Identifies the method to run before the test to allocate and configure resources needed by all tests in the test class. This class cannot be inherited.
Public class TestMethodAttribute Used to identify test methods. This class cannot be inherited.
Public class TestMethodInvokerContext Passed to the Unit Test Adapter to the TestExtensionExecution.CreateMethodInvoker.
Public class TestMethodInvokerResult The result that is returned by Invoke.
Public class TestPropertyAttribute Establishes a test specific property on a method. This class cannot be inherited.
Public class TimeoutAttribute Used to specify the time-out period of a unit test.
Public class UnitTestAssertException This is the base class for unit test exceptions.
Public class WebServiceHelper Contains helper methods for Web service testing.
Public class WorkItemAttribute Used to specify a work item associated with a test.

Interfaces

  Interface Description
Public interface ITestMethodInvoker Interface to invoke the test method body.

Delegates

  Delegate Description
Protected delegate BaseShadow.ElementConverter Delegate used for deep copying of arrays. Converts the source element of an array into the target element.

Enumerations

  Enumeration Description
Public enumeration DataAccessMethod Specifies constants that indicate how data rows are accessed in data-driven testing.
Public enumeration TestTimeout Enumeration for time-outs that can be used with the TimeoutAttribute class.
Public enumeration UnitTestOutcome Use UnitTestOutcome to programmatically determine the outcome of a test that has run or is currently running.

See Also

Reference

Other Resources

About Unit Tests

Working with Unit Tests

Creating Unit Tests

Walkthrough: Creating and Running Unit Tests for Managed Code

Walkthrough: Run Tests and View Code Coverage