本文整理汇总了C#中Fields.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Fields.Select方法的具体用法?C# Fields.Select怎么用?C# Fields.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fields
的用法示例。
在下文中一共展示了Fields.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectFieldReturnsCorrectField
public void SelectFieldReturnsCorrectField()
{
var sut = new Fields<ClassWithFields>();
FieldInfo actual = sut.Select(x => x.ReadOnlyText);
var expected = typeof(ClassWithFields).GetField("ReadOnlyText");
Assert.Equal(expected, actual);
}
示例2: SelectFieldDeclaredOnBaseReturnsCorrectField
public void SelectFieldDeclaredOnBaseReturnsCorrectField()
{
var sut = new Fields<SubClassWithFields>();
var expected = typeof(SubClassWithFields).GetField("ReadOnlyText");
var actual = sut.Select(x => x.ReadOnlyText);
Assert.Equal(expected, actual);
}
示例3: LuceneKeysExtractAll
public LuceneKeysExtractAll(LuceneConnection luceneConnection, Entity entity, bool input = false) {
_luceneConnection = luceneConnection;
_entity = entity;
_input = input;
_fields = entity.PrimaryKey;
if (entity.Version != null && !_fields.HaveField(entity.Version.Alias)) {
_fields.Add(entity.Version);
}
_selected = _fields.Select(f => input ? f.Name : f.Alias).ToArray();
}
示例4: SelectPropertiesThrows
public void SelectPropertiesThrows()
{
var sut = new Fields<ClassWithProperties>();
Assert.Throws<ArgumentException>(
() => sut.Select(x => x.ReadOnlyText));
}
示例5: SelectNullThrows
public void SelectNullThrows()
{
var sut = new Fields<ClassWithFields>();
Assert.Throws<ArgumentNullException>(
() => sut.Select<object>(null));
}
示例6: SelectNonMemberExpressionThrows
public void SelectNonMemberExpressionThrows()
{
var sut = new Fields<ClassWithFields>();
Assert.Throws<ArgumentException>(
() => sut.Select(x => x.ToString()));
}