Interface ICanPerformWhen
- Namespace
- CSF.Screenplay.Actors
- Assembly
- CSF.Screenplay.Abstractions.dll
An actor which is able to perform in the When phase of a IPerformance.
public interface ICanPerformWhen
- Extension Methods
Remarks
This interface is conceptually identical to ICanPerform, except that the nomenclature of its methods is written in the present tense, as is best pratice for the When phase of a performance. In addition, the wording of these methods indicates that the actor is attempting something, which might fail.
Methods
AttemptsTo(IPerformable, CancellationToken)
Performs an action or task which returns no result.
ValueTask AttemptsTo(IPerformable performable, CancellationToken cancellationToken = default)
Parameters
performable
IPerformableThe performable item
cancellationToken
CancellationTokenAn optional token to cancel the performable
Returns
- ValueTask
A task which completes when the performable is complete
AttemptsTo(IPerformableWithResult, CancellationToken)
Performs an action or task which returns an untyped result.
ValueTask<object> AttemptsTo(IPerformableWithResult performable, CancellationToken cancellationToken = default)
Parameters
performable
IPerformableWithResultThe performable item
cancellationToken
CancellationTokenAn optional token to cancel the performable
Returns
AttemptsTo<T>(IPerformableWithResult<T>, CancellationToken)
Performs an action or task which returns a strongly typed result.
ValueTask<T> AttemptsTo<T>(IPerformableWithResult<T> performable, CancellationToken cancellationToken = default)
Parameters
performable
IPerformableWithResult<T>The performable item
cancellationToken
CancellationTokenAn optional token to cancel the performable
Returns
- ValueTask<T>
A task which exposes a result when the performable is complete
Type Parameters
T
The result type