Interface IDataContext
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
variableNamestring
Property Value
Parameters
Gets the parameters set for this context.
IndexedDictionary<string, string> Parameters { get; }
Property Value
Parent
Gets or sets the parent data context.
DataContext Parent { get; }
Property Value
- DataContext
The parent data context of this context or
nullif 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
nullif 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
dataBindingInfoIDataBindingInfoThe data binding info object to retrieve data for.
Returns
- string
The data for the specified data binding info.
Exceptions
- ArgumentException
If
dataBindingInfois invalid.
Get(string)
Gets the data value for the specified variable name.
string Get(string variableName)
Parameters
variableNamestringThe name of the variable to retrieve data for.
Returns
- string
The data for the specified variable.
Exceptions
- ArgumentException
If
variableNameis 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
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
minintThe minimum row index.
maxintThe maximum row index.
oneBasedErrorMessageboolIf
true, one-based indexing is used in the error message (not for theminormaxvalues); 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
trueif the context was successfully advances to the next row;falseif the last row has been passed.
Next(bool)
Advances the context to the next data row.
bool Next(bool withAncestors)
Parameters
withAncestorsboolIf set to
true, ancestors of this context are also advanced to the next row if this context passed its last local row.
Returns
- bool
trueif the context was successfully advances to the next row;falseif 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
withAncestorsboolA 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
namestringThe name of the parameter.
Returns
- bool
trueif the parameter was successfully removed from the context; otherwise,false. This method also returnsfalseif 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
withAncestorsboolA 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
SetRange(DataRange)
Sets the range of rows in the data Source that should be enumerated.
void SetRange(DataRange dataRange)
Parameters
dataRangeDataRangeThe 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
Exceptions
- ArgumentException
If the specified range is not valid.