本文整理匯總了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));
}