本文整理汇总了C#中System.Methods.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Methods.Select方法的具体用法?C# Methods.Select怎么用?C# Methods.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Methods
的用法示例。
在下文中一共展示了Methods.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectNonMethodCallExpressionWithoutReturnThrows
public void SelectNonMethodCallExpressionWithoutReturnThrows()
{
var sut = new Methods<ClassWithMethods>();
Expression<Action<ClassWithMethods>> nonMethodCallExpression =
_ => new object();
Assert.Throws<ArgumentException>(
() => sut.Select(nonMethodCallExpression));
}
示例2: SelectParameterLessReturnsCorrectMethod
public void SelectParameterLessReturnsCorrectMethod()
{
var sut = new Methods<ClassWithMethods>();
MethodInfo actual = sut.Select(x => x.OmitParameters());
var expected = typeof(ClassWithMethods).GetMethod("OmitParameters");
Assert.Equal(expected, actual);
}
示例3: GuardClauses
public void GuardClauses()
{
IFixture fixture = new Fixture().Customize(new AutoRhinoMockCustomization());
fixture.Customize<Control>(c => c.OmitAutoProperties());
fixture.Customizations.Add(new PointBuilder());
var methods = new Methods<ValuesToolTip>();
var members = new List<MemberInfo>(typeof(ValuesToolTip).GetMembers());
members.Remove(methods.Select(tt => tt.Set(default(string))));
members.Remove(methods.Select(tt => tt.Set(default(string), default(Point))));
fixture.Create<GuardClauseAssertion>()
.Verify(members);
}
示例4: SelectNullThrows
public void SelectNullThrows()
{
var sut = new Methods<ClassWithMethods>();
Assert.Throws<ArgumentNullException>(() => sut.Select(null));
}
示例5: SelectNullFuncThrows
public void SelectNullFuncThrows()
{
var sut = new Methods<ClassWithMethods>();
Assert.Throws<ArgumentNullException>(() =>
sut.Select((Expression<Func<ClassWithMethods, object>>)null));
}
示例6: SelectNonMethodCallExpressionThrows
public void SelectNonMethodCallExpressionThrows()
{
var sut = new Methods<ClassWithMethods>();
Assert.Throws<ArgumentException>(
() => sut.Select(_ => 1 + 1));
}