Table of Contents

Interface IPerformableWithResult

Namespace
CSF.Screenplay
Assembly
CSF.Screenplay.Abstractions.dll

An object which represents something that a performer (typically an actor) may perform and which returns a result when it completes.

public interface IPerformableWithResult
Extension Methods

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 this interface are questions or tasks which are composed (at least in-part) from one or more questions. If you do not wish to get a result from the performable then implement only IPerformable instead. Alternatively, if you wish to return a strongly-typed result then instead consider implementing 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 and returns a value.

ValueTask<object> PerformAsAsync(ICanPerform actor, CancellationToken cancellationToken = default)

Parameters

actor ICanPerform

The actor that is performing.

cancellationToken CancellationToken

An optional cancellation token by which to abort the performable.

Returns

ValueTask<object>

A task which exposes a 'result' value when the performable represented by the current instance is complete.

See Also