public void TestPublisher_and_TestSubscriber_should_have_all_events_accessible_from_manual_probes()
{
this.AssertAllStagesStopped(() =>
{
var upstream = TestPublisher.CreateManualProbe<int>(this);
var downstream = TestSubscriber.CreateManualProbe<int>(this);
Source.FromPublisher(upstream)
.RunWith(Sink.AsPublisher<int>(false), Materializer)
.Subscribe(downstream);
var upstreamSubscription = upstream.ExpectSubscription();
object evt = downstream.ExpectEvent();
evt.Should().BeOfType<TestSubscriber.OnSubscribe>();
var downstreamSubscription = ((TestSubscriber.OnSubscribe) evt).Subscription;
upstreamSubscription.SendNext(1);
downstreamSubscription.Request(1);
evt = upstream.ExpectEvent();
evt.Should().BeOfType<TestPublisher.RequestMore>();
((TestPublisher.RequestMore) evt).NrOfElements.Should().Be(1);
evt = downstream.ExpectEvent();
evt.Should().BeOfType<TestSubscriber.OnNext<int>>();
((TestSubscriber.OnNext<int>) evt).Element.Should().Be(1);
upstreamSubscription.SendNext(1);
downstreamSubscription.Request(1);
downstream.ExpectNext(1);
upstreamSubscription.SendComplete();
evt = downstream.ExpectEvent();
evt.Should().BeOfType<TestSubscriber.OnComplete>();
}, Materializer);
}