The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
ExpectedExceptionAttribute Constructor (Type^)
Initializes a new instance of the ExpectedExceptionAttribute class with an expected exception.
Assembly: Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)
Parameters
- exceptionType
-
Type:
System::Type^
An expected type of exception to be thrown by a method.
If exceptionType is null, a diagnostic message will be sent to a trace listener.
Legacy Code Example
The following class contains the method to test:
The following test method tests the Divide method of the DivisionClass object. It tests for the existence of a DivideByZeroException.
Show: