public ExpectConditionInstruction( ITestWaitCondition <T> condition, TimeSpan timeout, SourceContext sourceContext) : base(() => new State(condition, timeout, sourceContext)) { }
private static ITestResponder <object> MakeErrorResponder <TWait>( ConstructionStrategy strategy, ITestWaitCondition <TWait> waitCondition) { object ThrowException(TWait _) => throw new Exception("Test"); ITestInstruction <object> throwInstruction = DoAndReturn("Throw", () => ThrowException(default));
public ContinuedWaitCondition( ITestWaitCondition <TFirst> first, Func <TFirst, ITestWaitCondition <TSecond> > continuation, SourceContext sourceContext) : base(() => new State(first, continuation, sourceContext)) { }
public SequencedWaitCondition( ITestWaitCondition <TFirst> first, ITestWaitCondition <TSecond> second, SourceContext sourceContext) : base(() => new State(first, second, sourceContext)) { }
internal TestResponder( string description, ITestWaitCondition <TArg> waitCondition, Func <TArg, ITestInstruction <T> > makeInstruction, SourceContext sourceContext) : base(() => new State(description, waitCondition, makeInstruction, sourceContext)) { }
public void SetUp() { this.mayCompleteFirst = false; this.mayCompleteSecond = false; this.waitForFirst = WaitForCondition("first", () => this.mayCompleteFirst); this.waitForSecond = WaitForCondition("second", () => this.mayCompleteSecond); }
public State( ITestWaitCondition <TFirst> first, ITestWaitCondition <TSecond> second, SourceContext sourceContext) : base(sourceContext) { this.first = first.CreateState(); this.second = second.CreateState(); }
public State( ITestWaitCondition <TFirst> first, Func <TFirst, ITestWaitCondition <TSecond> > continuation, SourceContext sourceContext) : base(sourceContext) { this.first = first.CreateState(); this.continuation = continuation; }
public State( ITestWaitCondition <TFirst> first, Func <TFirst, ITestWaitCondition <TSecond> > continuation, SourceContext sourceContext) : base(sourceContext) { this.first = first.CreateState(); this.continuation = new Continuation <TFirst, TSecond>( firstResult => continuation(firstResult).CreateState()); }
public static ITestInstruction <T> ExpectWithinSeconds <T>( this ITestWaitCondition <T> condition, double timeout, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new ExpectConditionInstruction <T>( condition, TimeSpan.FromSeconds(timeout), new SourceContext(nameof(ExpectWithinSeconds), memberName, sourceFilePath, sourceLineNumber));
public static ITestWaitCondition <T2> Select <T1, T2>( this ITestWaitCondition <T1> condition, Func <T1, T2> selector, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new SelectWaitCondition <T1, T2>( condition, selector, new SourceContext(nameof(Select), memberName, sourceFilePath, sourceLineNumber));
public static ITestWaitCondition <T> Until <T>( this IOptionalTestResponder respondTo, ITestWaitCondition <T> condition, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new UntilResponder <T>( respondTo, condition, new SourceContext(nameof(Until), memberName, sourceFilePath, sourceLineNumber));
public static ITestWaitCondition <TSecond> AndThen <TFirst, TSecond>( this ITestWaitCondition <TFirst> first, Func <TFirst, ITestWaitCondition <TSecond> > continuation, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new ContinuedWaitCondition <TFirst, TSecond>( first, continuation, new SourceContext(nameof(AndThen), memberName, sourceFilePath, sourceLineNumber));
public UntilResponder( IOptionalTestResponder responder, ITestWaitCondition <T> condition, SourceContext sourceContext) : base(() => new UntilResponderState <T>( "UNTIL", responder.CreateState(), condition.CreateState(), sourceContext)) { }
public State( string description, ITestWaitCondition <TArg> waitCondition, Func <TArg, ITestInstruction <T> > makeInstruction, SourceContext sourceContext) : base(sourceContext) { this.Description = description; this.waitCondition = waitCondition.CreateState(); this.makeInstruction = makeInstruction; }
public static ITestResponder <TResult> ThenRespondWith <TWait, TResult>( this ITestWaitCondition <TWait> condition, string description, Func <TWait, ITestInstruction <TResult> > selector, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new TestResponder <TWait, TResult>( description, condition, selector, new SourceContext(nameof(ThenRespondWith), memberName, sourceFilePath, sourceLineNumber));
public static ITestResponder <object> ThenRespondWithAction <TWait>( this ITestWaitCondition <TWait> condition, string description, Action <TWait> action, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new TestResponder <TWait, object>( description, condition, waitResult => new SynchronousTestInstruction <object>( description, action.ReturnUnit(waitResult), new SourceContext(nameof(ThenRespondWithAction), memberName, sourceFilePath, sourceLineNumber)), new SourceContext(nameof(ThenRespondWithAction), memberName, sourceFilePath, sourceLineNumber));
private static ITestResponder <object> MakeObjectResponder <TWait>( ConstructionStrategy strategy, ITestWaitCondition <TWait> waitCondition) { var obj = new object(); switch (strategy) { case ConstructionStrategy.Continuation: return(waitCondition.ThenRespondWith("Respond", x => Return(obj))); case ConstructionStrategy.Instruction: return(waitCondition.ThenRespondWith("Respond", Return(obj))); case ConstructionStrategy.Func: return(waitCondition.ThenRespondWithFunc("Respond", _ => obj)); case ConstructionStrategy.Action: return(waitCondition.ThenRespondWithAction("Respond", _ => { })); default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, "Unhandled strategy"); } }
public BoxedWaitCondition(ITestWaitCondition <T> condition) : base(() => new BoxedOperationState <T, object>( condition.CreateState(), value => (object)value)) { }
public BoxedWaitCondition(ITestWaitCondition <T> condition) : base(() => new BoxedOperationState <T>(condition.CreateState())) { }
public State(ITestWaitCondition <T> condition, TimeSpan timeout, SourceContext sourceContext) : base(sourceContext) { this.condition = condition.CreateState(); this.timeout = timeout; }
public SelectWaitCondition(ITestWaitCondition <T1> condition, Func <T1, T2> selector, SourceContext sourceContext) : base(() => new SelectOperationState <T1, T2>(condition.CreateState(), selector, sourceContext)) { }
public static ITestWaitCondition <object> BoxResult <T>(this ITestWaitCondition <T> condition) where T : struct => new BoxedWaitCondition <T>(condition);
public void OneTimeSetUp() { this.waitForComplete = WaitForConditionOn("Wait", () => this.complete, val => val); this.returnTrue = DoAndReturn("Set completed", () => true); this.throwError = DoAndReturn <int>("Throw error", () => throw new Exception("")); }