Class ToStringFormatter
- Namespace
- CSF.Screenplay.Reporting
- Assembly
- CSF.Screenplay.dll
Implementation of IValueFormatter which formats any object by using its default ToString() method,
or returns the string <null>
if the value is null.
public class ToStringFormatter : IValueFormatter
- Inheritance
-
ToStringFormatter
- Implements
- Inherited Members
Remarks
This formatter should be used as a default/last resort. It is very likely that this could produce results which are not particularly human readable.
Methods
CanFormat(object)
Gets a value indicating whether this object is suitable for formatting the specified value.
public bool CanFormat(object value)
Parameters
value
objectThe value to be formatted
Returns
FormatForReport(object)
Gets a formatted string which represents the specified value.
public string FormatForReport(object value)
Parameters
value
objectThe value to be formatted
Returns
- string
A formatted string which represents the specified value.
Remarks
Ensure that the value
has been tested with CanFormat(object) before executing this method.
The behaviour of this method is undefined for any value for which the can-format method does not return true.
It may lead to exceptions or garbage output.