public void Error()
        {
            var cs1 = new MaybeSubject <int>();
            var cs2 = new MaybeSubject <int>();

            var to = cs1
                     .TakeUntil(cs2)
                     .Test();

            Assert.True(cs1.HasObserver());
            Assert.True(cs2.HasObserver());

            cs1.OnError(new InvalidOperationException());

            Assert.False(cs1.HasObserver());
            Assert.False(cs2.HasObserver());

            to.AssertFailure(typeof(InvalidOperationException));
        }
        public void Basic_Other()
        {
            var cs1 = new MaybeSubject <int>();
            var cs2 = new MaybeSubject <int>();

            var to = cs1
                     .TakeUntil(cs2)
                     .Test();

            Assert.True(cs1.HasObserver());
            Assert.True(cs2.HasObserver());

            cs2.OnCompleted();

            Assert.False(cs1.HasObserver());
            Assert.False(cs2.HasObserver());

            to.AssertResult();
        }
        public void Observable_Dispose()
        {
            var cs1 = new MaybeSubject <int>();
            var cs2 = new UnicastSubject <int>();

            var to = cs1
                     .TakeUntil(cs2)
                     .Test();

            Assert.True(cs1.HasObserver());
            Assert.True(cs2.HasObserver());

            to.Dispose();

            Assert.False(cs1.HasObserver());
            Assert.False(cs2.HasObserver());

            to.AssertEmpty();
        }
        public void Success_Other()
        {
            var cs1 = new MaybeSubject <int>();
            var cs2 = new MaybeSubject <int>();

            var to = cs1
                     .TakeUntil(cs2)
                     .Test();

            Assert.True(cs1.HasObserver());
            Assert.True(cs2.HasObserver());

            cs2.OnSuccess(1);

            Assert.False(cs1.HasObserver());
            Assert.False(cs2.HasObserver());

            to.AssertResult();
        }
        public void Observable_Basic_Other_OnNext()
        {
            var cs1 = new MaybeSubject <int>();
            var cs2 = new UnicastSubject <int>();

            var to = cs1
                     .TakeUntil(cs2)
                     .Test();

            Assert.True(cs1.HasObserver());
            Assert.True(cs2.HasObserver());

            cs2.OnNext(1);

            Assert.False(cs1.HasObserver());
            Assert.False(cs2.HasObserver());

            to.AssertResult();
        }