Class IdentifierAndName
- Namespace
- CSF.Screenplay.Performances
- Assembly
- CSF.Screenplay.Abstractions.dll
A model which indicates a unique identifier and a corresponding human-readable name.
public sealed class IdentifierAndName : IEquatable<IdentifierAndName>, IHasName
- Inheritance
-
IdentifierAndName
- Implements
- Inherited Members
Constructors
IdentifierAndName(string, string, bool)
Initialises a new instance of IdentifierAndName
public IdentifierAndName(string identifier, string name = null, bool wasIdentifierAutoGenerated = false)
Parameters
identifier
stringThe identifier for this item, which might not be human-readable
name
stringA human-readable name for this item
wasIdentifierAutoGenerated
boolA value that indicates whether or not
identifier
is an auto-generated value
Exceptions
- ArgumentNullException
If
identifier
is null
Properties
Identifier
Gets the identifier for the current item
public string Identifier { get; }
Property Value
Remarks
The identifier for an item might not be a human-readable value. It is required to uniquely identify the current item, however.
Name
Gets a human-readable name for the current item
public string Name { get; }
Property Value
Remarks
The human-readable name in this context is not mandatory, and so this property might return a null reference if no name was specified.
WasIdentifierAutoGenerated
Gets a value indicating whether or not the Identifier is an automatically-generated value or not.
public bool WasIdentifierAutoGenerated { get; }
Property Value
Remarks
Some integrations with Screenplay do not provide a suitable unique identifier for this position. In that case, because a unique identifier is required, Screenplay generates a unique identifier (the string representation of a GUID) automatically and uses it as the Identifier. Obviously, if that is the case then the identifier will have no meaning or correspondence to anything in the logic consuming Screenplay.
This property is used to indicate when this is the case; if it is true then the Identifier was randomly-generated by Screenplay.
Methods
Equals(IdentifierAndName)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(IdentifierAndName other)
Parameters
other
IdentifierAndNameAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.