Table of Contents

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

uri string

The URI to associate with this instance.

name string

The 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

uri Uri

The URI to associate with this instance.

name string

The 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

string

Uri

Gets the Uri associated with this instance.

public Uri Uri { get; }

Property Value

Uri

Methods

RebaseTo(Uri)

Gets a copy of the current named URI, except 'rebased' using the specified base URI.

public NamedUri RebaseTo(Uri baseUri)

Parameters

baseUri Uri

A 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)

Converts a string to a NamedUri.

public static implicit operator NamedUri(string uri)

Parameters

uri string

The URI to convert.

Returns

NamedUri

A new NamedUri instance.

implicit operator NamedUri(Uri)

Converts a Uri to a NamedUri.

public static implicit operator NamedUri(Uri uri)

Parameters

uri Uri

The URI to convert.

Returns

NamedUri

A new NamedUri instance.