Exemple #1
0
        public void Disposed()
        {
            var us = new MonocastSubject <int>();

            var to = new TestObserverLocal();

            bool[] disposed = { false };

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

            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);
        }