Table of Contents

Interface IPerformableWithResult<TResult>

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 strongly-typed result when it completes.

public interface IPerformableWithResult<TResult>

Type Parameters

TResult
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.

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 strongly-typed value.

ValueTask<TResult> 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<TResult>

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

See Also