Skip to content

ExceptionAssertions<T>.HaveMessage Method ​

Definition ​

Asserts that the exception has the specified message.

c#
public AssertionsChain<ExceptionAssertions<T>, T> HaveMessage(string expected, StringComparison comparison = StringComparison.System.StringComparison);

View source

Parameters ​

NameTypeDescription
expectedStringThe expected message.
comparisonStringComparisonThe StringComparison to use. Defaults to InvariantCulture.

Returns ​

AssertionsChain<ExceptionAssertions<T>, T>

An AssertionsChain<TAssertions, T> for chaining further assertions.