public void WithOneBoundedSetup <TIn, TOut>(IGraphStageWithMaterializedValue <Shape, object>[] ops, Action <Func <ISet <OneBoundedSetup.ITestEvent> >, OneBoundedSetup.UpstreamOneBoundedProbe <TIn>, OneBoundedSetup.DownstreamOneBoundedPortProbe <TOut> > spec) { var setup = new OneBoundedSetup <TIn, TOut>(Sys, ops); spec(setup.LastEvents, setup.Upstream, setup.Downstream); }
public DownstreamOneBoundedPortProbe(OneBoundedSetup setup) { _setup = setup; In = new Inlet <T>("in") { Id = 0 }; SetHandler(In, () => { setup.LastEvent.Add(new OnNext(Grab <object>(In))); }, () => setup.LastEvent.Add(new OnComplete()), ex => setup.LastEvent.Add(new OnError(ex))); }
public UpstreamOneBoundedProbe(OneBoundedSetup setup) { _setup = setup; Out = new Outlet <T>("out") { Id = 0 }; SetHandler(Out, () => { if (setup.LastEvent.OfType <RequestOne>().Any()) { setup.LastEvent.Add(new RequestAnother()); } else { setup.LastEvent.Add(new RequestOne()); } }, () => setup.LastEvent.Add(new Cancel())); }