本文整理汇总了C#中Record.GetField方法的典型用法代码示例。如果您正苦于以下问题:C# Record.GetField方法的具体用法?C# Record.GetField怎么用?C# Record.GetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record.GetField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Given_an_invalid_heading_name__should_throw_an_exception
public void Given_an_invalid_heading_name__should_throw_an_exception()
{
var record = new Record(new string[] { }, new Dictionary<string, int>());
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
record.GetField("foo");
// ReSharper restore ReturnValueOfPureMethodIsNotUsed
}
示例2: Record
public void Given_a_valid_heading_whose_index_is_valid_for_the_record__should_return_the_corresponding_field_value()
{
var record = new Record(new[] { "aa", "bb" }, new Dictionary<string, int>
{
{ "b", 1 }
});
var field = record.GetField("b");
field.ShouldBeEqualTo("bb");
}
示例3: Given_a_valid_heading_whose_index_exceeds_the_number_of_fields__should_return_null
public void Given_a_valid_heading_whose_index_exceeds_the_number_of_fields__should_return_null()
{
var record = new Record(new[] { "aa", "bb" }, new Dictionary<string, int>
{
{ "c", 2 }
});
var field = record.GetField("c");
field.ShouldBeNull();
}
示例4: Given_index_value_exceeds_available_number_of_fields__should_throw_an_exception
public void Given_index_value_exceeds_available_number_of_fields__should_throw_an_exception()
{
var record = new Record(new string[] { }, "a", "b");
// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
record.GetField(10);
}
示例5: Given_the_record_does_not_contain_a_value_for_the_heading__should_return_null
public void Given_the_record_does_not_contain_a_value_for_the_heading__should_return_null()
{
var record = new Record(new string[] { null }, new Dictionary<string, int>());
var field = record.GetField(0);
field.ShouldBeNull();
}
示例6: Given_a_valid_index_value__should_return_the_field_value
public void Given_a_valid_index_value__should_return_the_field_value()
{
var record = new Record(new[] { "a", "b", "c" }, new Dictionary<string, int>());
var field = record.GetField(1);
field.ShouldBeEqualTo("b");
}
示例7: Given_a_negative_index_value__should_throw_an_exception
public void Given_a_negative_index_value__should_throw_an_exception()
{
var record = new Record(new string[] { }, new Dictionary<string, int>());
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
record.GetField(-1);
// ReSharper restore ReturnValueOfPureMethodIsNotUsed
}