Table of Contents

Class ScreenplayServiceCollectionExtensions

Namespace
CSF.Screenplay
Assembly
CSF.Screenplay.dll

Extension methods for IServiceCollection relating to Screenplay.

public static class ScreenplayServiceCollectionExtensions
Inheritance
ScreenplayServiceCollectionExtensions
Inherited Members

Methods

AddScreenplay(IServiceCollection, Action<ScreenplayOptions>)

Adds the Screenplay framework to the specified service collection.

public static IServiceCollection AddScreenplay(this IServiceCollection services, Action<ScreenplayOptions> options = null)

Parameters

services IServiceCollection

An IServiceCollection

options Action<ScreenplayOptions>

An optional configuration action, used to configure Screenplay in DI

Returns

IServiceCollection

The service collection, so that calls may be chained

Remarks

Use this method to add Screenplay to an existing service collection; if you just want an instance of Screenplay and do not care for integrating it with a service collection of your own then consider the convenience method Create(Action<IServiceCollection>, Action<ScreenplayOptions>).

If you choose to provide any configuration via the options parameter, do not 'capture' the ScreenplayOptions object outside the closure. This object is added to dependency injection as a singleton, and so if it is modified outside of this configuration action then the integrity of the Screenplay dependency injection may be compromised.

Exceptions

ArgumentNullException

If services is null.