Table of Contents

Class Stage

Namespace
CSF.Screenplay.Actors
Assembly
CSF.Screenplay.dll

The default implementation of IStage which provides a context for which actor is currently active.

public sealed class Stage : IStage, IHasPerformanceIdentity
Inheritance
Stage
Implements
Inherited Members

Constructors

Stage(ICast, IRelaysPerformanceEvents)

Initialises a new instance of Stage

public Stage(ICast cast, IRelaysPerformanceEvents performanceEventBus)

Parameters

cast ICast

The cast

performanceEventBus IRelaysPerformanceEvents

An event bus for collecting stage-related events

Exceptions

ArgumentNullException

If any parameter value is null

Properties

Cast

Gets the cast to which the current stage is linked.

public ICast Cast { get; }

Property Value

ICast

PerformanceIdentity

Gets the unique IPerformance identifier

public Guid PerformanceIdentity { get; }

Property Value

Guid

Remarks

This value is used to uniquely identify a performance within a CSF.Screenplay.

Methods

GetSpotlitActor()

Gets the actor which is currently in the spotlight.

public Actor GetSpotlitActor()

Returns

Actor

The actor who has previously been placed in the spotlight, or a null reference if there is presently no actor in the spotlight.

Spotlight(Actor)

Places the specified actor into the spotlight, making them 'the current actor' on this stage.

public void Spotlight(Actor actor)

Parameters

actor Actor

Remarks

A maximum of one actor may be in the spotlight at any time, so if a different actor is already in the spotlight as this method is used, then they will be implicitly removed and replaced by the specified actor. The actor who is in the spotlight may be retrieved by calling GetSpotlitActor().

If the specified actor is already in the spotlight then this method will have no effect, the actor will remain in the spotlight.

To remove an actor from the spotlight without replacing them, use TurnSpotlightOff().

Exceptions

ArgumentNullException

If the actor is null.

Spotlight(IPersona)

Places an actor matching the specified persona into the spotlight, making them 'the current actor' on this stage.

public Actor Spotlight(IPersona persona)

Parameters

persona IPersona

Returns

Actor

The actor instance which was placed into the spotlight.

Remarks

A maximum of one actor may be in the spotlight at any time, so if a different actor is already in the spotlight as this method is used, then they will be implicitly removed and replaced by the actor derived from the persona. The actor who is in the spotlight may be retrieved by calling GetSpotlitActor().

If actor indicated by the persona is already in the spotlight then this method will have no effect, the actor will remain in the spotlight.

When spotlighting a persona, the actor instance is retrieved from an ICast based upon that same persona. See GetActor(IPersona) for more information.

To remove an actor from the spotlight without replacing them, use TurnSpotlightOff().

Consider using Spotlight<TPersona>(IStage) instead of this method; the generic version takes care of resolving the persona instance from dependency injection for you.

Exceptions

ArgumentNullException

If the actor is null.

TurnSpotlightOff()

Removes any existing actor from the spotlight, ensuring that no actor is in the spotlight.

public Actor TurnSpotlightOff()

Returns

Actor

If an actor was previously in the spotlight, and has now been removed, then this method returns that actor; otherwise it will return a null reference.

Remarks

If there was already no actor in the spotlight when this method is executed then it will have no effect, the spotlight will remain empty and this method will return null.