Class NamedUri
- Namespace
- CSF.Screenplay.Selenium
- Assembly
- CSF.Screenplay.Selenium.dll
Model containing a Uri with a corresponding human-readable name.
public sealed class NamedUri : IHasName
- Inheritance
-
NamedUri
- Implements
- Inherited Members
- Extension Methods
Remarks
This model allows for the association of human-readable names with URIs. This is most useful when making use of Screenplay reports, where the human-readable name can be used to describe the URI in a more user-friendly way.
Note the inclusion of implicit conversion operators which allow for seamless conversion from Uri and/or string instances to instances of this type.
Constructors
NamedUri(string, string)
Initializes a new instance of the NamedUri class.
public NamedUri(string uri, string name = null)
Parameters
uristringThe URI to associate with this instance.
namestringThe human-readable name for the URI. If null, the URI string will be used as the name.
NamedUri(Uri, string)
Initializes a new instance of the NamedUri class.
public NamedUri(Uri uri, string name = null)
Parameters
uriUriThe URI to associate with this instance.
namestringThe human-readable name for the URI. If null, the URI string will be used as the name.
Properties
Name
Gets the human-readable name for this Uri.
public string Name { get; }
Property Value
Uri
Gets the Uri associated with this instance.
public Uri Uri { get; }
Property Value
Methods
RebaseTo(Uri)
Gets a copy of the current named URI, except 'rebased' using the specified base URI.
public NamedUri RebaseTo(Uri baseUri)
Parameters
baseUriUriA new base URI
Returns
- NamedUri
A URI which might have been rebased onto the new base URI
Remarks
If the current Uri is Absolute then this method has not effect and the named URI which is returned is the unmodified current instance.
If the current Uri is not absolute, then the specified base URI is prepended to the current URI, serving as a base. The new URI is then returned from this method. Note that this method will never result in the current instance being mutated, at most it will only return a copy of the current instance, which has the newly-rebased URI.
Operators
implicit operator NamedUri(string)
public static implicit operator NamedUri(string uri)
Parameters
uristringThe URI to convert.
Returns
implicit operator NamedUri(Uri)
public static implicit operator NamedUri(Uri uri)
Parameters
uriUriThe URI to convert.