ExpectedExceptionBaseAttribute ExpectedExceptionBaseAttribute ExpectedExceptionBaseAttribute Class

Definition

Base class for attributes that specify to expect an exception from a unit test

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public abstract class ExpectedExceptionBaseAttribute : Attribute
type ExpectedExceptionBaseAttribute = class
    inherit Attribute
Public MustInherit Class ExpectedExceptionBaseAttribute
Inherits Attribute
Inheritance
ExpectedExceptionBaseAttributeExpectedExceptionBaseAttributeExpectedExceptionBaseAttribute
Derived
Attributes

Constructors

ExpectedExceptionBaseAttribute() ExpectedExceptionBaseAttribute() ExpectedExceptionBaseAttribute()

Initializes a new instance of the ExpectedExceptionBaseAttribute class with a default no-exception message

ExpectedExceptionBaseAttribute(String) ExpectedExceptionBaseAttribute(String) ExpectedExceptionBaseAttribute(String)

Initializes a new instance of the ExpectedExceptionBaseAttribute class with a no-exception message

Properties

NoExceptionMessage NoExceptionMessage NoExceptionMessage

Gets the message to include in the test result if the test fails due to not throwing an exception

SpecifiedNoExceptionMessage SpecifiedNoExceptionMessage SpecifiedNoExceptionMessage

Gets the message to include in the test result if the test fails due to not throwing an exception

Methods

RethrowIfAssertException(Exception) RethrowIfAssertException(Exception) RethrowIfAssertException(Exception)

Rethrow the exception if it is an AssertFailedException or an AssertInconclusiveException

Verify(Exception) Verify(Exception) Verify(Exception)

Determines whether the exception is expected. If the method returns, then it is understood that the exception was expected. If the method throws an exception, then it is understood that the exception was not expected, and the thrown exception's message is included in the test result. The Assert class can be used for convenience. If Inconclusive() is used and the assertion fails, then the test outcome is set to Inconclusive.

Applies to