public void Timeout_Fallback_Error()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var count = 0;
            var fb    = CompletableSource.FromAction(() =>
            {
                ++count;
                throw new InvalidOperationException();
            });

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts, fb)
                     .Test();

            to.AssertEmpty();

            ts.AdvanceTimeBy(100);

            Assert.True(us.HasObserver());

            ts.AdvanceTimeBy(900);

            Assert.False(us.HasObserver());

            to.AssertFailure(typeof(InvalidOperationException));

            Assert.AreEqual(1, count);
        }
        public void Timeout_Fallback()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var count = 0;
            var fb    = CompletableSource.FromAction(() => count++);

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts, fb)
                     .Test();

            to.AssertEmpty();

            ts.AdvanceTimeBy(100);

            Assert.True(us.HasObserver());

            ts.AdvanceTimeBy(900);

            Assert.False(us.HasObserver());

            to.AssertResult();

            Assert.AreEqual(1, count);
        }
        public void Dispose_Main()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts)
                     .Test();

            Assert.True(us.HasObserver());

            to.Dispose();

            Assert.False(us.HasObserver());

            ts.AdvanceTimeBy(1000);

            to.AssertEmpty();
        }
        public void No_Timeout_Error()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts)
                     .Test();

            to.AssertEmpty();

            ts.AdvanceTimeBy(100);

            Assert.True(us.HasObserver());

            us.OnError(new InvalidOperationException());

            ts.AdvanceTimeBy(900);

            to.AssertFailure(typeof(InvalidOperationException));
        }
        public void No_Timeout()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts)
                     .Test();

            to.AssertEmpty();

            ts.AdvanceTimeBy(100);

            Assert.True(us.HasObserver());

            us.OnCompleted();

            ts.AdvanceTimeBy(900);

            to.AssertResult();
        }
        public void Timeout()
        {
            var ts = new TestScheduler();
            var us = new CompletableSubject();

            var to = us
                     .Timeout(TimeSpan.FromSeconds(1), ts)
                     .Test();

            to.AssertEmpty();

            ts.AdvanceTimeBy(100);

            Assert.True(us.HasObserver());

            ts.AdvanceTimeBy(900);

            Assert.False(us.HasObserver());

            to.AssertFailure(typeof(TimeoutException));
        }