public void Disposed()
        {
            var us = new UnicastSubject <int>();

            var to = new TestObserverLocal();

            bool[] disposed = { false };

            var d = us.ConcatMap(v => new OnDispose <int>(Enumerable.Range(v * 100, 5), disposed))
                    .Subscribe(to);

            to.OnSubscribe(d);

            Assert.True(us.HasObserver());

            to.AssertEmpty();

            us.OnNext(1);

            to.AssertValuesOnly(100, 101, 102, 103, 104);

            Assert.True(us.HasObserver());

            us.OnNext(2);

            Assert.False(us.HasObserver());

            Assert.True(disposed[0]);

            to.AssertResult(100, 101, 102, 103, 104, 200, 201);
        }
        public void Error()
        {
            var count = 0;

            var us = new UnicastSubject <int>();

            var to = us
                     .ConcatMap(v => {
                if (v == 2)
                {
                    return(CompletableSource.Error(new InvalidOperationException()));
                }
                return(CompletableSource.FromAction(() => count++));
            })
                     .Test();

            to.AssertEmpty()
            .AssertSubscribed();

            us.OnNext(0);
            us.OnNext(1);
            us.OnNext(2);

            to.AssertFailure(typeof(InvalidOperationException));

            Assert.False(us.HasObserver());

            Assert.AreEqual(2, count);
        }