Interface ICanPerform
- Namespace
- CSF.Screenplay
- Assembly
- CSF.Screenplay.Abstractions.dll
An actor which may perform in the Screenplay.
public interface ICanPerform
- Extension Methods
Methods
PerformAsync(IPerformable, CancellationToken)
Performs an action or task which returns no result.
ValueTask PerformAsync(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
PerformAsync(IPerformableWithResult, CancellationToken)
Performs a question or question-like task which returns an untyped result.
ValueTask<object> PerformAsync(IPerformableWithResult performable, CancellationToken cancellationToken = default)
Parameters
performable
IPerformableWithResultThe performable item
cancellationToken
CancellationTokenAn optional token to cancel the performable
Returns
PerformAsync<T>(IPerformableWithResult<T>, CancellationToken)
Performs a question or question-like task which returns a strongly typed result.
ValueTask<T> PerformAsync<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
RecordAsset(object, string, string)
Records the existence of a new performable asset file at the specified path.
void RecordAsset(object performable, string filePath, string fileSummary = null)
Parameters
performable
objectThe performable item
filePath
stringThe full absolute path to the asset file
fileSummary
stringAn optional human-readable summary of the asset file
Remarks
File assets are sometimes created during a performance as a reporting/verification mechanism. For example a performable which controls the user interface of an application might take and save a screenshot of that UI so that a human may later verify that everything looked as it should.
Alternatively, file assets might constitute part of the output of a performance. Imagine an application of Screenplay which captures video from a security camera; that video file would be an asset.
This method may be used from performables which generate and save asset files. They ensure that appropriate events are called and passed 'upward' through the Screenplay architecture, such that subscribers may be notified. This will allow the presence and details of assets to be included in Screenplay artifacts such as reports.