示例#1
0
        public void Eager_OnCompleted_Cleanup_AsyncFused()
        {
            var complete = -1;
            var to       = new TestObserver <int>(requireOnSubscribe: true, fusionRequested: FusionSupport.Any);

            ObservableSource.Using(() => 0, _ => ObservableSource.Empty <int>(), _ => complete = to.CompletionCount, true)
            .Subscribe(to);

            to
            .AssertFuseable()
            .AssertFusionMode(FusionSupport.Async)
            .AssertResult();

            Assert.AreEqual(0, complete);
        }
        public void Sync_Fused_Bad_OnNext()
        {
            var to     = new TestObserver <int>(true, FusionSupport.Sync);
            var parent = new BadSyncFuseableDisposable(to);

            to.OnSubscribe(parent);

            to.AssertFuseable()
            .AssertFusionMode(FusionSupport.Sync);

            to.OnNext(1);

            Assert.AreEqual(1, to.ErrorCount);

            to.AssertError(typeof(InvalidOperationException));
        }
示例#3
0
        public void Eager_Fused_Crash_Cleanup()
        {
            var complete = -1;
            var to       = new TestObserver <int>(requireOnSubscribe: true, fusionRequested: FusionSupport.Any);

            ObservableSource.Using(() => 0,
                                   _ => ObservableSource.Range(1, 5)
                                   .Map <int, int>(w => throw new InvalidOperationException()),
                                   _ => complete = to.ErrorCount, true)
            .Subscribe(to);

            to
            .AssertFuseable()
            .AssertFusionMode(FusionSupport.Sync)
            .AssertFailure(typeof(InvalidOperationException));

            Assert.AreEqual(0, complete);
        }