private ITestInstruction <object> ContinueWithError <T>( ITestInstruction <T> first, Strategy strategy) { switch (strategy) { case Strategy.Continuation: return(first.ContinueWith(_ => ErrorInstruction)); case Strategy.Instruction: return(first.ContinueWith(ErrorInstruction)); default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, "Unhandled strategy"); } }
private ITestInstruction <object> ContinueWithNothing <T>( ITestInstruction <T> first, Strategy strategy) { var second = this.waitForSecond.ExpectWithinSeconds(1); switch (strategy) { case Strategy.Continuation: return(first.ContinueWith(_ => second)); case Strategy.Instruction: return(first.ContinueWith(second)); default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, "Unhandled strategy"); } }
/// <summary> /// Standard extension method required to support LINQ query syntax. /// Should not be used directly. /// </summary> public static ITestInstruction <TResult> SelectMany <TSource, TSelector, TResult>( this ITestInstruction <TSource> source, Func <TSource, ITestInstruction <TSelector> > selector, Func <TSource, TSelector, TResult> resultSelector) => source .ContinueWith(x => selector(x).Select(y => resultSelector(x, y)));