Interface IPerformable
- Namespace
- CSF.Screenplay
- Assembly
- CSF.Screenplay.Abstractions.dll
An object which represents something that a performer (typically an actor) may perform.
public interface IPerformable
Remarks
Performable objects generally fall into one of three categories in Screenplay:
- An action, which is the most fine-grained type of performable, typically "doing something which alters the state of the application"
- A question, which is fine-grained like an action but instead reads state without changing it
- A task, which may be composed of actions, questions or even other tasks
Objects which implement only this interface are the simplest types of performables; they simply 'do something' and then finish. In the list given above these are typically actions. They do not return any form of result except completion. If you wish to get a result from the performable then consider implementing an interface derived from this one, such as IPerformableWithResult or its strongly-typed counterpart IPerformableWithResult<TResult>.
When implementing this interface, consider also implementing ICanReport. If a performable does not implement ICanReport then it will receive default text when the IPerformance report is generated. Implementing ICanReport allows a performable to provide a customised human-readable report fragment.
Methods
PerformAsAsync(ICanPerform, CancellationToken)
Performs the action(s) are represented by the current instance.
ValueTask PerformAsAsync(ICanPerform actor, CancellationToken cancellationToken = default)
Parameters
actor
ICanPerformThe actor that is performing.
cancellationToken
CancellationTokenAn optional cancellation token by which to abort the performable.
Returns
- ValueTask
A task which completes when the performable represented by the current instance is complete.