public void Completed_Dispose_Other()
        {
            var ms = new MaybeSubject <int>();

            var to1 = new TestObserver <int>();

            var count = 0;

            ms.Subscribe(v => { count = 1; }, e => { count = 2; }, () => { to1.Dispose(); });

            ms.Subscribe(to1);

            ms.OnCompleted();

            to1.AssertEmpty();

            Assert.AreEqual(0, count);
        }
        public void Error_Dispose_Other()
        {
            var ms = new MaybeSubject <int>();

            var to1 = new TestObserver <int>();

            var count = 0;

            ms.Subscribe(v => { count = 1; }, e => { to1.Dispose(); }, () => { count = 2; });

            ms.Subscribe(to1);

            ms.OnError(new InvalidOperationException());

            to1.AssertEmpty();

            Assert.AreEqual(0, count);
        }
        public void Dispose()
        {
            var count = 0;

            var ss = new MaybeSubject <int>();

            var d = ss
                    .Subscribe(v => { count = v; }, e => { count = 2; }, () => { count = 3; });

            Assert.True(ss.HasObserver());

            d.Dispose();

            Assert.False(ss.HasObserver());
            Assert.AreEqual(0, count);
        }