Table of Contents

Method ThrowsAnyAsync

Namespace
Xunit
Assembly
xunit.v3.assert.dll

ThrowsAnyAsync<T>(Func<Task>)

Verifies that the exact exception or a derived exception type is thrown.

public static Task<T> ThrowsAnyAsync<T>(Func<Task> testCode) where T : Exception

Parameters

testCode Func<Task>

A delegate to the task to be tested

Returns

Task<T>

The exception that was thrown, when successful

Type Parameters

T

The type of the exception expected to be thrown