コード例 #1
0
        public void Maybe_Dispose_Inner()
        {
            var ss = new MaybeSubject <int>();
            var cs = new CompletableSubject();

            var to = ss
                     .FlatMap(v => cs)
                     .Test();

            to.AssertSubscribed();

            Assert.True(ss.HasObserver());
            Assert.False(cs.HasObserver());

            ss.OnSuccess(1);

            Assert.True(cs.HasObserver());
            Assert.False(ss.HasObserver());

            to.AssertEmpty();

            cs.OnCompleted();

            to.AssertResult();
        }
コード例 #2
0
        public void Maybe_Dispose_Main()
        {
            var ss    = new MaybeSubject <int>();
            var count = 0;

            var to = ss
                     .FlatMap(v => CompletableSource.FromAction(() => count++))
                     .Test();

            to.AssertSubscribed();

            Assert.True(ss.HasObserver());

            to.Dispose();

            Assert.False(ss.HasObserver());
        }