Skip to content

ExceptionAssertions<T>.HaveMessageStartingWith Method ​

Definition ​

Asserts that the exception message starts with the specified string.

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

View source

Parameters ​

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

Returns ​

AssertionsChain<ExceptionAssertions<T>, T>

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