public void perform_invoke_processes_handler() { //Arrange var urlRegistry = MockRepository.GenerateStub <IUrlRegistry>(); var outputWriter = MockRepository.GenerateStub <IOutputWriter>(); var fubuRequest = MockRepository.GenerateStub <IFubuRequest>(); var continuation = FubuContinuation.TransferTo(new object()); fubuRequest.Stub(r => r.Get <FubuContinuation>()).Return(continuation); fubuRequest.Stub(r => r.Find <IRedirectable>()).Return(new IRedirectable[0]); var partialFactory = MockRepository.GenerateStub <IPartialFactory>(); var partialBehavior = MockRepository.GenerateStub <IActionBehavior>(); partialFactory.Stub(f => f.BuildPartial(typeof(object))).Return(partialBehavior); var handler = new ContinuationHandler(urlRegistry, outputWriter, fubuRequest, partialFactory); var insideBehavior = MockRepository.GenerateStub <IActionBehavior>(); handler.InsideBehavior = insideBehavior; //Act handler.Invoke(); //Assert TransferTo was called by _request.Get<FubuContinuation>().Process(this); partialFactory.AssertWasCalled(f => f.BuildPartial(typeof(object))); partialBehavior.AssertWasCalled(p => p.InvokePartial()); //Assert performInvoke() returned Stop insideBehavior.AssertWasNotCalled(b => b.Invoke()); }
private IEnumerator Run() { if (_task != null) { while (_task.MoveNext()) { Result = _task.Current; yield return(Result); } } else { yield return(null); } _then?.Invoke(Result); }
private async void Run() { /* FIXME * if (_task != null) * { * while (_task.MoveNext()) * { * Result = _task.Current; * yield return Result; * } * } * else * { * yield return null; * } */ await Task.Run(() => _then?.Invoke(Result)); }
public void Handle(Type modelType, Notification notification) { _request.Set(_continuation); _handler.Invoke(); }