コード例 #1
0
        public void Time_Dispose_Other()
        {
            var ts = new TestScheduler();

            var cs = new MaybeSubject <int>();

            var to = cs
                     .DelaySubscription(TimeSpan.FromSeconds(1), ts)
                     .Test();

            Assert.False(cs.HasObserver());

            ts.AdvanceTimeBy(500);

            Assert.False(cs.HasObserver());

            ts.AdvanceTimeBy(500);

            Assert.True(cs.HasObserver());

            to.Dispose();

            Assert.False(cs.HasObserver());

            to.AssertEmpty();
        }
コード例 #2
0
        public void Other_Dispose_Other()
        {
            var ts = new MaybeSubject <int>();

            var cs = new MaybeSubject <int>();

            var to = cs
                     .DelaySubscription(ts)
                     .Test();

            Assert.False(cs.HasObserver());

            ts.OnCompleted();

            Assert.True(cs.HasObserver());

            to.Dispose();

            Assert.False(cs.HasObserver());

            to.AssertEmpty();
        }