Skip to content

AsyncActionAssertions Class

Definition

Provides assertions for async actions (delegates returning Task), such as verifying that exceptions are thrown.

public sealed class AsyncActionAssertions

Constructors

Name Description
AsyncActionAssertions(Func<Task>) Provides assertions for async actions (delegates returning Task), such as verifying that exceptions are thrown.

Methods

Name Description
NotThrowAsync() Asserts that the async action does not throw any exception.
ThrowArgumentExceptionAsync(String, String) Asserts that the async action throws an ArgumentException with the specified message and parameter name.
ThrowArgumentOutOfRangeExceptionAsync(String, String, Object) Asserts that the async action throws an ArgumentOutOfRangeException with the specified message, parameter name and actual value.
ThrowAsync<TException>() Asserts that the async action throws an exception of the specified type.
ThrowAsync<TException>(String) Asserts that the async action throws an exception of the specified type with the specified message.
ThrowAsync<TException>(String, Exception) Asserts that the async action throws an exception of the specified type with the specified message and inner exception.
ThrowAsync<TException>(TException) Asserts that the async action throws the exact specified exception instance.