src/NUnit/Core/src/TaskTests/TaskExtensions.cs
/// <summary>
/// <para>
/// Asserts that task is not erroneous, otherwise
/// the inner exceptions are thrown within 
/// <see cref="Assert.Multiple(TestDelegate)"/>.
/// </para>
/// <para>
/// You may call it in a
/// test case that is decorated with 
/// <see cref="TaskTestCaseBlockStaticMemberSourceAttribute"/> or
/// <see cref="TestCaseSourceAttribute"/> that provides 
/// assertable task as first parameter.
/// </para>
/// </summary>
/// <param name="task">The task to be asserted.</param>
Asserts that task is not erroneous, otherwise
the inner exceptions are thrown within
.

You may call it in a
test case that is decorated with
or
that provides
assertable task as first parameter.
Asserts that task is not erroneous otherwise the inner exceptions are thrown within . You may call it in a test case that is decorated with or that provides assertable task as first parameter .
public static void AssertIsNotErroneous(this Task task)
        {
            if (task.Exception is null) {
                Assert.Pass();
            }
            Assert.Multiple(() => {
                foreach (var error in task.Exception!.InnerExceptions) {
                    Assert.DoesNotThrow(() => throw error);
                }
            });
        }
public static void AssertIsNotErroneous ( this Task task ) { if ( task . Exception is null ) { Assert . Pass ( ) ; } Assert . Multiple ( ( ) => { foreach ( var error in task . Exception ! . InnerExceptions ) { Assert . DoesNotThrow ( ( ) => throw error ) ; } } ) ; }
Asserts that task is not erroneous, otherwise
the inner exceptions are thrown within
.
Asserts that task is not erroneous otherwise the inner exceptions are thrown within .
Task
this
task
The task to be asserted.
The task to be asserted .