Table of Contents

Class ScreenplayReportBuilder

Namespace
CSF.Screenplay.Reporting
Assembly
CSF.Screenplay.dll

Builder type accumulates PerformanceReportBuilder as performances occur within the Screenplay.

public class ScreenplayReportBuilder
Inheritance
ScreenplayReportBuilder
Inherited Members

Remarks

This type is used by JsonScreenplayReporter so that it may direct the appropriate reports (relating to performances) to the appropriate performance. Be mindful that performances could be occurring in parallel, so it would be incorrect to maintain a concept of "the current performance". This class provides a thread-safe mechanism by which to access the builder for each performance, as they occur.

Use BeginPerformance(Guid, IReadOnlyList<IdentifierAndName>) in order to add a new performance to this builder. During that performance's lifespan use GetPerformanceBuilder(Guid) in order to direct logic to its builder. Once the performance is over, use EndPerformanceAndGetReport(Guid, bool?) to remove that performance from this instance (it doesn't need tracking once it's finished) and to get the completed report for that performance.

Constructors

ScreenplayReportBuilder(Func<List<IdentifierAndNameModel>, PerformanceReportBuilder>)

Initialises a new instance of ScreenplayReportBuilder.

public ScreenplayReportBuilder(Func<List<IdentifierAndNameModel>, PerformanceReportBuilder> performanceBuilderFactory)

Parameters

performanceBuilderFactory Func<List<IdentifierAndNameModel>, PerformanceReportBuilder>

A factory function for performance report builders

Exceptions

ArgumentNullException

If performanceBuilderFactory is null.

Methods

BeginPerformance(Guid, IReadOnlyList<IdentifierAndName>)

Begins building a report about a new performance.

public void BeginPerformance(Guid performanceIdentifier, IReadOnlyList<IdentifierAndName> namingHierarchy)

Parameters

performanceIdentifier Guid

The performance identifier

namingHierarchy IReadOnlyList<IdentifierAndName>

A naming hierarchy for that performance

Remarks

This method adds the new performance to the state of the current instance, so that it tracked and may be built by accumulating further reporting data. Once the performance is being tracked, use GetPerformanceBuilder(Guid) to return a reference to that builder. Use EndPerformanceAndGetReport(Guid, bool?) once the performance is finished (successfully or otherwise), which will remove it from the current Screenplay builder.

See Also

EndPerformanceAndGetReport(Guid, bool?)

Ends the specified performance, removing its builder from the current instance, and returns the completed/built report.

public PerformanceReport EndPerformanceAndGetReport(Guid performanceIdentifier, bool? success)

Parameters

performanceIdentifier Guid

The performance identifier

success bool?

A value indicating whether or not the performance was a success. This has the same semantics as the parameter to FinishPerformance(bool?)

Returns

PerformanceReport

The performance report which was built by the performance report builder

Exceptions

ArgumentException

If the current Screenplay builder does not have a tracked performance with the specified performanceIdentifier.

See Also

GetPerformanceBuilder(Guid)

Gets the performance builder corresponding to the specified identifier.

public PerformanceReportBuilder GetPerformanceBuilder(Guid performanceIdentifier)

Parameters

performanceIdentifier Guid

The performance identifier

Returns

PerformanceReportBuilder

A performance report builder which corresponds to the requested performance

Exceptions

ArgumentException

If the current Screenplay builder does not have a tracked performance with the specified performanceIdentifier.

See Also

See Also