public void Interpreter_must_call_PostStop_in_order_on_stages_when_upstream_OnErrors()
        {
            var op = new PreStartAndPostStopIdentity <string>(onUpstreamFailed: ex => TestActor.Tell(ex.Message),
                                                              onStop: () => TestActor.Tell("stop-c"));

            WithOneBoundedSetup(op, (lastEvents, upstream, downstream) =>
            {
                var msg = "Boom! Boom! Boom!";
                upstream.OnError(new TestException(msg));
                ExpectMsg(msg);
                ExpectMsg("stop-c");
                ExpectNoMsg(300);
            });
        }
                public Logic(PreStartAndPostStopIdentity <T> stage) : base(stage.Shape)
                {
                    _stage = stage;

                    SetHandler(stage.Outlet, () => Pull(stage.Inlet));
                    SetHandler(stage.Inlet, () => Push(stage.Outlet, Grab(stage.Inlet)), () =>
                    {
                        stage._onUpstreamCompleted();
                        CompleteStage();
                    }, ex =>
                    {
                        stage._onUpstreamFailed(ex);
                        FailStage(ex);
                    });
                }
        public void Interpreter_must_call_PreStart_before_PostStop()
        {
            var op = new PreStartAndPostStopIdentity <string>(onStart: () => TestActor.Tell("start-a"),
                                                              onStop: () => TestActor.Tell("stop-a"));


            WithOneBoundedSetup(op, (lastEvents, upstream, downstream) =>
            {
                ExpectMsg("start-a");
                ExpectNoMsg(300);
                upstream.OnComplete();
                ExpectMsg("stop-a");
                ExpectNoMsg(300);
            });
        }