Class DefaultStrings
- Namespace
- CSF.Screenplay
- Assembly
- CSF.Screenplay.Abstractions.dll
An object which provides default human readable strings
public static class DefaultStrings
- Inheritance
-
DefaultStrings
- Inherited Members
Remarks
This is most commonly used when dealing with performables which do not implement ICanReport.
Methods
FormatValue(object)
Formats a value
public static string FormatValue(object value)
Parameters
value
objectThe value to format
Returns
- string
The formatted value
Remarks
If the value implements IHasName then its Name will be returned, otherwise the result of ToString() will be returned, or an empty string if the value is null. If, by any chance, there is an exception raised whilst formatting the value then a string will be returned which indicates this and contains the exception details.
GetAbilityReport(object, object)
Gets a fallback report fragment for an ability which does not implement ICanReport.
public static string GetAbilityReport(object actor, object ability)
Parameters
Returns
- string
The report fragment
Remarks
This mechanism of getting a report fragment uses a simple fallback string which is similar to:
{Actor} is able to {Ability}
. The actor and ability objects will be formatted by FormatValue(object).
GetReport(object, object)
Gets a fallback report fragment for a performable which does not implement ICanReport.
public static string GetReport(object actor, object performable)
Parameters
Returns
- string
The report fragment
Remarks
This mechanism of getting a report fragment uses a simple fallback string which is similar to:
{Actor} performs {Performable}
. The actor and performable objects will be formatted by FormatValue(object).