Exemplo n.º 1
0
        public void Error_Delayed()
        {
            var us1 = new UnicastSubject <int>();
            var us2 = new UnicastSubject <int>();

            var to = ReactiveExtensions.Zip(a =>
            {
                int s = 0;
                foreach (var v in a)
                {
                    s += v;
                }
                return(s);
            }, true,
                                            us1,
                                            us2
                                            ).Test();

            us1.EmitError(new InvalidOperationException(), 1, 2, 3);

            Assert.True(us2.HasObserver(), "us2: No observers!");

            us2.Emit(10, 20, 30, 40);

            Assert.False(us2.HasObserver(), "us2: Observers present!");

            to.AssertFailure(typeof(InvalidOperationException), 11, 22, 33);
        }
        public void Error()
        {
            var us = new UnicastSubject <int>().ToSerialized();

            var to = us.Test();

            us.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5);

            to.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5);
        }
Exemplo n.º 3
0
        public void Basic_With_Error()
        {
            var up = new UnicastSubject <int>();

            var to = new TestObserver <int>();

            up.Subscribe(ReactiveExtensions.ToSerialized(to));

            up.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5);

            to.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5);
        }
Exemplo n.º 4
0
        public void Error_Delayed()
        {
            var us = new UnicastSubject <int>();

            var ts = us.ObserveOn(ImmediateScheduler.INSTANCE, true).Test();

            Assert.True(us.HasObserver());

            ts.AssertEmpty();

            us.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

            ts.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
        }
Exemplo n.º 5
0
        public void Basic_Error()
        {
            var count = 0;

            var up = new UnicastSubject <int>();

            var ts = up.DoFinally(() => count++).Test();

            up.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5);

            ts.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5);
            ts.Dispose();

            Assert.AreEqual(1, count);
        }