Skip to content

ExceptionAssertions<T> Class ​

Definition ​

Provides assertions for exception values.

c#
public sealed class ExceptionAssertions<T> : ObjectAssertions<ExceptionAssertions<T>, T>
   where T : Exception

View source

Type Parameters ​

NameDescription
TThe type of the exception being asserted on.

Constructors ​

NameDescription
ExceptionAssertions(T)Provides assertions for exception values.

Methods ​

NameDescription
HaveInnerException<TException>()Asserts that the exception has an inner exception of the specified type.
HaveInnerException<TException>(TException)Asserts that the exception has the exact specified inner exception instance.
HaveMessage(String, StringComparison)Asserts that the exception has the specified message.
HaveMessageStartingWith(String, StringComparison)Asserts that the exception message starts with the specified string.
NotHaveInnerException()Asserts that the exception does not have an inner exception.
NotHaveMessage(String, StringComparison)Asserts that the exception does not have the specified message.
NotHaveMessageStartingWith(String, StringComparison)Asserts that the exception message does not start with the specified string.