Пример #1
0
        public void An_ObservableSource_must_receive_events_from_an_observable()
        {
            this.AssertAllStagesStopped(() =>
            {
                var o = new TestObservable <int>();
                var s = this.CreateManualSubscriberProbe <int>();
                Source.FromObservable(o)
                .To(Sink.FromSubscriber(s))
                .Run(_materializer);

                var sub = s.ExpectSubscription();

                sub.Request(2);

                o.Event(1);
                o.Event(2);
                o.Event(3);

                s.ExpectNext(1);
                s.ExpectNext(2);
                s.ExpectNoMsg();

                sub.Request(2);

                s.ExpectNext(3);
                s.ExpectNoMsg();

                o.Event(4);

                s.ExpectNext(4);

                o.Complete();
            }, _materializer);
        }
Пример #2
0
        public void An_ObservableSource_must_subscribe_to_an_observable()
        {
            this.AssertAllStagesStopped(() =>
            {
                var o = new TestObservable <int>();
                var s = this.CreateManualSubscriberProbe <int>();
                Source.FromObservable(o)
                .To(Sink.FromSubscriber(s))
                .Run(_materializer);

                var sub = s.ExpectSubscription();

                o.Complete();
            }, _materializer);
        }