public void Dispose()
        {
            var ms   = new MaybeSubject <int>();
            var subj = new Subject <int>();

            var to = ms.RepeatWhen(v => subj).Test();

            Assert.True(ms.HasObserver());
            Assert.True(subj.HasObservers);

            to.Dispose();

            Assert.False(ms.HasObserver());
            Assert.False(subj.HasObservers);
        }
        public void Handler_Completes_Prematurely()
        {
            var ms   = new MaybeSubject <int>();
            var subj = new Subject <int>();

            var to = ms.RepeatWhen(v => subj).Test();

            Assert.True(ms.HasObserver());
            Assert.True(subj.HasObservers);

            subj.OnCompleted();

            Assert.False(ms.HasObserver());
            Assert.False(subj.HasObservers);

            to.AssertResult();
        }
        public void Handler_Fails_Prematurely()
        {
            var ms   = new MaybeSubject <int>();
            var subj = new Subject <int>();

            var to = ms.RepeatWhen(v => subj).Test();

            Assert.True(ms.HasObserver());
            Assert.True(subj.HasObservers);

            subj.OnError(new InvalidOperationException());

            Assert.False(ms.HasObserver());
            Assert.False(subj.HasObservers);

            to.AssertFailure(typeof(InvalidOperationException));
        }