本文整理汇总了C#中Tuple.Item2方法的典型用法代码示例。如果您正苦于以下问题:C# Tuple.Item2方法的具体用法?C# Tuple.Item2怎么用?C# Tuple.Item2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tuple
的用法示例。
在下文中一共展示了Tuple.Item2方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Check_null_return
public void Check_null_return(Tuple<string, TestAction> test)
{
var exception = Assert.Throws<ActionResultAssertionException>(() =>
test.Item2(_controller.WithCallTo(c => c.Null()))
);
Assert.That(exception.Message, Is.EqualTo(string.Format("Received null action result when expecting {0}.", test.Item1)));
}
示例2: Check_return_type
public void Check_return_type(Tuple<string, TestAction> test)
{
var exception = Assert.Throws<ActionResultAssertionException>(() =>
test.Item2(_controller.WithCallTo(c => c.RandomResult()))
);
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected action result to be a {0}, but instead received a RandomResult.", test.Item1)));
}
示例3: CreateExecutor
/// <summary>
/// Creates the executor which can resolve a passed type and hand it
/// to the closure
/// </summary>
/// <param name="stateValuePair">The state value pair.</param>
/// <returns>a lambda lifted closure</returns>
private static Func<Tuple<IResolveTypes, object>, object, object, object> CreateExecutor(Tuple<Type, Func<object, object, object, object>> stateValuePair)
{
return (resolver, name, value) =>
{
object item = null;
if (stateValuePair.Item1 != null)
item = resolver.Item1.Resolve(stateValuePair.Item1);
return stateValuePair.Item2(resolver.Item2, item, value);
};
}
示例4: Execute
internal bool Execute(
bool skipIfNoChanges, bool formValuesChanged, Action<EwfValidation, IEnumerable<string>> validationErrorHandler, bool performValidationOnly = false,
Tuple<Action, Action> actionMethodAndPostModificationMethod = null)
{
var validationNeeded = validations.Any() && ( !skipIfNoChanges || formValuesChanged );
if( validationNeeded ) {
var topValidator = new Validator();
foreach( var validation in validations ) {
if( topValidations.Contains( validation ) )
validation.Method( AppRequestState.Instance.EwfPageRequestState.PostBackValues, topValidator );
else {
var validator = new Validator();
validation.Method( AppRequestState.Instance.EwfPageRequestState.PostBackValues, validator );
if( validator.ErrorsOccurred )
topValidator.NoteError();
validationErrorHandler( validation, validator.ErrorMessages );
}
}
if( topValidator.ErrorsOccurred )
throw new DataModificationException( Translation.PleaseCorrectTheErrorsShownBelow.ToSingleElementArray().Concat( topValidator.ErrorMessages ).ToArray() );
}
var skipModification = !modificationMethods.Any() || ( skipIfNoChanges && !formValuesChanged );
if( performValidationOnly || ( skipModification && actionMethodAndPostModificationMethod == null ) )
return validationNeeded;
DataAccessState.Current.DisableCache();
try {
if( !skipModification ) {
foreach( var method in modificationMethods )
method();
}
if( actionMethodAndPostModificationMethod != null )
actionMethodAndPostModificationMethod.Item1();
DataAccessState.Current.ResetCache();
AppRequestState.Instance.PreExecuteCommitTimeValidationMethodsForAllOpenConnections();
if( actionMethodAndPostModificationMethod != null )
actionMethodAndPostModificationMethod.Item2();
}
catch {
AppRequestState.Instance.RollbackDatabaseTransactions();
DataAccessState.Current.ResetCache();
throw;
}
return true;
}
示例5: CreateButton
private Button CreateButton(Tuple<string, Func<bool>> buttonInfo)
{
TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
buttonFactory.FixedHeight = this.FixedHeight;
buttonFactory.normalFillColor = this.normalFillColor;
buttonFactory.normalTextColor = this.normalTextColor;
buttonFactory.hoverTextColor = this.hoverTextColor;
buttonFactory.hoverFillColor = this.hoverFillColor;
buttonFactory.borderWidth = 1;
buttonFactory.normalBorderColor = this.normalBorderColor;
buttonFactory.hoverBorderColor = this.hoverBorderColor;
Button button = buttonFactory.Generate(buttonInfo.Item1, normalImageName: imageName, centerText: true);
button.Click += (object sender, EventArgs e) =>
{
buttonInfo.Item2();
};
return button;
}
示例6: EmitExceptionBlockCore
private void EmitExceptionBlockCore( Action<TracingILGenerator, Label> tryBlockEmitter, Tuple<Type, Action<TracingILGenerator, Label, Type>> firstCatchBlockEmitter, Tuple<Type, Action<TracingILGenerator, Label, Type>>[] remainingCatchBlockEmitters, Action<TracingILGenerator, Label> finallyBlockEmitter )
{
var endOfExceptionBlock = this.BeginExceptionBlock();
tryBlockEmitter( this, endOfExceptionBlock );
if ( firstCatchBlockEmitter != null )
{
this.BeginCatchBlock( firstCatchBlockEmitter.Item1 );
firstCatchBlockEmitter.Item2( this, endOfExceptionBlock, firstCatchBlockEmitter.Item1 );
}
foreach ( var catchBlockEmitter in remainingCatchBlockEmitters )
{
this.BeginCatchBlock( catchBlockEmitter.Item1 );
firstCatchBlockEmitter.Item2( this, endOfExceptionBlock, catchBlockEmitter.Item1 );
}
if ( finallyBlockEmitter != null )
{
this.BeginFinallyBlock();
finallyBlockEmitter( this, endOfExceptionBlock );
}
this.EndExceptionBlock();
}
示例7: ap_cmb
private Action ap_cmb(Tuple<Action, Action> code)
{
return delegate() { code.Item1(); code.Item2(); };
}