public ExpectTestResponse( ITestResponder <T> responder, TimeSpan timeout, SourceContext sourceContext) : base(() => new State(responder, timeout, sourceContext)) { }
public static ITestResponder <T2> Select <T1, T2>( this ITestResponder <T1> responder, Func <T1, T2> selector, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new SelectResponder <T1, T2>( responder, selector, new SourceContext(nameof(Select), memberName, sourceFilePath, sourceLineNumber));
public static ITestInstruction <T> ExpectWithinSeconds <T>( this ITestResponder <T> responder, double timeoutSeconds, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new ExpectTestResponse <T>( responder, TimeSpan.FromSeconds(timeoutSeconds), new SourceContext(nameof(ExpectWithinSeconds), memberName, sourceFilePath, sourceLineNumber));
public State( ITestResponder <T1> responder, Func <T1, T2> selector, SourceContext sourceContext) : base(sourceContext) { this.responder = responder.CreateState(); this.selector = selector; this.sourceContext = sourceContext; }
public static ITestResponder <T> UntilReadyTo <T>( this IOptionalTestResponder respondTo, ITestResponder <T> untilReady, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) => new UntilReadyToResponder <T>( respondTo, untilReady, new SourceContext(nameof(UntilReadyTo), memberName, sourceFilePath, sourceLineNumber));
public UntilReadyToResponder( IOptionalTestResponder respondTo, ITestResponder <T> untilReady, SourceContext sourceContext) : base(() => new UntilResponderState <ITestOperationState <T> >( "UNTIL READY TO", respondTo.CreateState(), untilReady.CreateState(), sourceContext)) { }
public void SetUp() { this.readyToReact = this.readyToComplete = this.startedToReact = false; var react = DoAndReturn("Set started to react", () => this.startedToReact = true) .ContinueWith(_ => WaitForCondition( "Ready to complete", () => this.readyToComplete) .ExpectWithinSeconds(3)); this.respondToConditions = WaitForCondition("To be ready", () => this.readyToReact) .ThenRespondWith("React", react); }
public ConditionResponder(int responseTimeout, T returnValue) { this.Responder = WaitForCondition("Wait to be ready", () => { if (this.waitException != null) { throw this.waitException; } return(this.MayRespond); }) .ThenRespondWith( "Respond", DoAndReturn("Set started to respond", () => this.StartedToRespond = true) .ContinueWith(this.WaitAndComplete(responseTimeout, returnValue))); }
public State(ITestResponder <T> responder, TimeSpan timeout, SourceContext sourceContext) : base(sourceContext) { this.responder = responder.CreateState(); this.timeout = timeout; }
public BoxedTestResponder(ITestResponder <T> responder) : base(() => new BoxedOperationState <ITestOperationState <T>, ITestOperationState <object> >( responder.CreateState(), TestOperationState.BoxResult)) { }
public static ITestResponder <object> BoxResult <T>(this ITestResponder <T> responder) where T : struct => new BoxedTestResponder <T>(responder);
public static IOptionalTestResponder Optionally <T>(this ITestResponder <T> responder) => new AnyOfResponder <T>(new[] { responder });
public SelectResponder(ITestResponder <T1> responder, Func <T1, T2> selector, SourceContext sourceContext) : base(() => new State(responder, selector, sourceContext)) { }