Skip to content

InvokingExtensions.Invoking Method

Overloads

Name Description
Invoking<T>(T, Action<T>) Wraps an action on the specified value for assertion testing.
Invoking<T, TResult>(T, Func<T, TResult>) Wraps a function on the specified value as an action for assertion testing, discarding the return value.

Invoking<T>(T, Action<T>)

Wraps an action on the specified value for assertion testing.

public static Action Invoking<T>(this T? value, Action<T> action);

Type Parameters

Name Description
T The type of the value.

Parameters

Name Type Description
value T The value to pass to the action.
action Action<T> The action to test.

Returns

Action

An action that invokes the specified action with the value, for use with Should(Action).

Invoking<T, TResult>(T, Func<T, TResult>)

Wraps a function on the specified value as an action for assertion testing, discarding the return value.

public static Action Invoking<T, TResult>(this T? value, Func<T, TResult> action);

Type Parameters

Name Description
T The type of the value.
TResult The return type of the function.

Parameters

Name Type Description
value T The value to pass to the function.
action Func<T, TResult> The function to test.

Returns

Action

An action that invokes the specified function with the value, for use with Should(Action).