本文整理汇总了C#中IDataItem.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IDataItem.GetValue方法的具体用法?C# IDataItem.GetValue怎么用?C# IDataItem.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataItem
的用法示例。
在下文中一共展示了IDataItem.GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyDataItem
protected static void VerifyDataItem(IReadOnlyDictionary<string, object> expected, IDataItem actual)
{
var actualColumns = actual.GetFieldNames().ToList();
foreach (var key in expected.Keys)
{
Assert.IsTrue(actualColumns.Contains(key), TestResources.PropertyMissingFormat, key);
Assert.AreEqual(expected[key], actual.GetValue(key), TestResources.InvalidPropertyValueFormat, key);
}
}
示例2: GetDataItemHash
private static int GetDataItemHash(IDataItem dataItem)
{
var result = 0;
foreach (var fieldName in dataItem.GetFieldNames())
{
var value = dataItem.GetValue(fieldName);
if (value == null)
continue;
result ^= fieldName.GetHashCode() ^ (
value is IDataItem
? GetDataItemHash((IDataItem)value)
: GetValueHashCode(value));
}
return result;
}
示例3: GetValueImpl
/// <inheritdoc />
protected override object GetValueImpl(IDataItem item)
{
object value = item.GetValue(binding);
return value;
}
示例4: Bind
private static object Bind(IDataAccessor accessor, IDataItem bindingItem, IFormatter formatter)
{
try
{
return accessor.GetValue(bindingItem);
}
catch (DataBindingException ex)
{
using (TestLog.Failures.BeginSection("Data binding failure"))
{
if (!string.IsNullOrEmpty(ex.Message))
TestLog.Failures.WriteLine(ex.Message);
bool first = true;
foreach (DataBinding binding in bindingItem.GetBindingsForInformalDescription())
{
if (first)
{
TestLog.Failures.Write("\nAvailable data bindings for this item:\n\n");
first = false;
}
using (TestLog.Failures.BeginMarker(Marker.Label))
{
TestLog.Failures.Write(binding);
TestLog.Failures.Write(": ");
}
TestLog.Failures.WriteLine(bindingItem.GetValue(binding));
}
if (first)
TestLog.Failures.Write("\nThis item does not appear to provide any data bindings.\n");
}
throw new SilentTestException(TestOutcome.Error);
}
}
示例5: GetValues
private static object[] GetValues(IDataItem item, ICollection<DataBinding> bindings)
{
try
{
return GenericCollectionUtils.ConvertAllToArray<DataBinding, object>(bindings, delegate(DataBinding binding)
{
return item.GetValue(binding);
});
}
catch
{
return null;
}
}