Table of Contents

Interface IDataContext

Namespace
Ranorex.Core.Data
Assembly
Ranorex.Core.dll

Provides an interface for a context to enumerate through data from cascaded sources.

public interface IDataContext

Properties

AvailableDataColumnNames

Gets a list of available data column names.

IList<DataConnectorBindingInfo> AvailableDataColumnNames { get; }

Property Value

IList<DataConnectorBindingInfo>

The available data column names.

CurrentRow

Gets the row the data context is currently positioned at.

Row CurrentRow { get; }

Property Value

Row

The current row.

CurrentRowIndex

Gets the index of the current row.

int CurrentRowIndex { get; }

Property Value

int

The index of the current row.

EffectiveRow

Gets the effective row the context is currently positioned at, that is the CurrentRow of this context concatenated with the current rows of all ancestor contexts.

Row EffectiveRow { get; }

Property Value

Row

The current effective row.

this[string]

Gets the value from the specified variable name.

string this[string variableName] { get; }

Parameters

variableName string

Property Value

string

Parameters

Gets the parameters set for this context.

IndexedDictionary<string, string> Parameters { get; }

Property Value

IndexedDictionary<string, string>

The parameters of this context.

Parent

Gets or sets the parent data context.

DataContext Parent { get; }

Property Value

DataContext

The parent data context of this context or null if this context does not have a parent.

Source

Gets or sets the data source associated with this context.

DataCache Source { get; set; }

Property Value

DataCache

The data source of this context or null if no data source is associated with this context.

Methods

ClearData()

Clears the data from the data Source associated with this context.

void ClearData()

Remarks

Should be called only form the TEARDOWN of the associated 'TestCase'.

Get(IDataBindingInfo)

Gets the data value for the specified data binding info

string Get(IDataBindingInfo dataBindingInfo)

Parameters

dataBindingInfo IDataBindingInfo

The data binding info object to retrieve data for.

Returns

string

The data for the specified data binding info.

Exceptions

ArgumentException

If dataBindingInfo is invalid.

Get(string)

Gets the data value for the specified variable name.

string Get(string variableName)

Parameters

variableName string

The name of the variable to retrieve data for.

Returns

string

The data for the specified variable.

Exceptions

ArgumentException

If variableName is invalid.

GetDataRangeInvalidString(int, int)

Checks if the data range is valid and returns an error message (using one-based indexing) if it is not.

string GetDataRangeInvalidString(int min, int max)

Parameters

min int

The minimum row index.

max int

The maximum row index.

Returns

string

An error message if the data range is not valid; otherwise, null.

Remarks

One-based indexing is used for the error message (not for the min or max values).

GetDataRangeInvalidString(int, int, bool)

Checks if the data range is valid and returns an error message if it is not.

string GetDataRangeInvalidString(int min, int max, bool oneBasedErrorMessage)

Parameters

min int

The minimum row index.

max int

The maximum row index.

oneBasedErrorMessage bool

If true, one-based indexing is used in the error message (not for the min or max values); otherwise zero-based indexing is used.

Returns

string

An error message if the data range is not valid; otherwise, null.

Next()

Advances the context and its ancestors to the next data row.

bool Next()

Returns

bool

true if the context was successfully advances to the next row; false if the last row has been passed.

Next(bool)

Advances the context to the next data row.

bool Next(bool withAncestors)

Parameters

withAncestors bool

If set to true, ancestors of this context are also advanced to the next row if this context passed its last local row.

Returns

bool

true if the context was successfully advances to the next row; false if the last row has been passed.

ReloadData()

Reloads the data from the data Source associated with this context and reloads data in ancestor contexts, too.

void ReloadData()

ReloadData(bool)

Reloads the data from the data Source associated with this context and optionally reloads data in ancestor contexts, too.

void ReloadData(bool withAncestors)

Parameters

withAncestors bool

A value specifying if the data in ancestor contexts should also be reloaded.

RemoveParameter(string)

Removes the parameter with the specified name from this context.

bool RemoveParameter(string name)

Parameters

name string

The name of the parameter.

Returns

bool

true if the parameter was successfully removed from the context; otherwise, false. This method also returns false if the parameter is not found.

Reset()

Resets the data context, i.e. sets the context to its initial position which is before the first data row, and also its ancestors.

void Reset()

Reset(bool)

Resets the data context, i.e. sets the context to its initial position which is before the first data row, and optionally also its ancestors.

void Reset(bool withAncestors)

Parameters

withAncestors bool

A value specifying if the ancestors of this context should also be reset.

SetFullRange()

Instructs the data context to enumerate all rows in the data Source.

void SetFullRange()

SetParameter(string, string)

Sets a parameter value for this context.

void SetParameter(string name, string value)

Parameters

name string

The name of the parameter.

value string

The value of the parameter.

SetRange(DataRange)

Sets the range of rows in the data Source that should be enumerated.

void SetRange(DataRange dataRange)

Parameters

dataRange DataRange

The range thas should be enumerated.

Exceptions

ArgumentNullException

If the given DataRange is null.

ArgumentException

If the given DataRange is not valid.

SetRange(int, int)

Sets the range of rows in the data Source that should be enumerated.

void SetRange(int min, int max)

Parameters

min int

The minimum row index.

max int

The maximum row index.

Exceptions

ArgumentException

If the specified range is not valid.