Exemple #1
0
        public void Retry_Observable_Throws2()
        {
            Run(scheduler =>
            {
                var ys = Subscribable.Throw <int>(new Exception()).Apply(scheduler).Retry();

                var sub = ys.Subscribe(Observer.Create <int>(x => { }, ex => { throw new InvalidOperationException(); }, () => { }));

                InitializeSubscription(sub, scheduler);

                scheduler.ScheduleAbsolute(210, () => sub.Dispose());

                scheduler.Start();
            });
        }
Exemple #2
0
        public void Retry_Observable_RetryCount_Throws()
        {
            Run(scheduler =>
            {
                var xs = Subscribable.Return(1).Apply(scheduler).Retry(3);

                var sub = xs.Subscribe(Observer.Create <int>(x => { throw new InvalidOperationException(); }, ex => { }, () => { }));

                InitializeSubscription(sub, scheduler);

                ReactiveAssert.Throws <InvalidOperationException>(() => scheduler.Start());
            });

            Run(scheduler =>
            {
                var ys = Subscribable.Throw <int>(new Exception()).Apply(scheduler).Retry(100);

                var sub = ys.Subscribe(Observer.Create <int>(x => { }, ex => { throw new InvalidOperationException(); }, () => { }));

                InitializeSubscription(sub, scheduler);

                scheduler.ScheduleAbsolute(10, () => sub.Dispose());

                scheduler.Start();
            });

            Run(scheduler =>
            {
                var zs = Subscribable.Return(1).Apply(scheduler).Retry(100);

                var sub = zs.Subscribe(Observer.Create <int>(x => { }, ex => { }, () => { throw new InvalidOperationException(); }));

                InitializeSubscription(sub, scheduler);

                ReactiveAssert.Throws <InvalidOperationException>(() => scheduler.Start());
            });

            Run(scheduler =>
            {
                var xss = Observable.Create <int>(new Func <IObserver <int>, IDisposable>(o => { throw new InvalidOperationException(); })).ToSubscribable().Retry(3);
                new SubscriptionInitializeVisitor(xss.Subscribe(Observer.Create <int>(x => { }, ex => { throw ex; }, () => { }))).Initialize(scheduler.CreateContext());
                ReactiveAssert.Throws <InvalidOperationException>(() => scheduler.Start());
            });
        }
 public static ISubscribable <T> Throw <T>(this TestScheduler scheduler, Exception error)
 {
     return(Subscribable.Throw <T>(error));
 }
Exemple #4
0
 public void Throw_ArgumentChecking()
 {
     Assert.ThrowsException <ArgumentNullException>(() => Subscribable.Throw <int>(null));
 }