public virtual IDisposable Subscribe(IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException("observer"); } subscriptions.Add(new Subscription(scheduler.Clock)); var index = subscriptions.Count - 1; var d = new CompositeDisposable(); for (var i = 0; i < messages.Length; ++i) { var notification = messages[i].Value; d.Add(scheduler.ScheduleRelative(default(object), messages[i].Time, (scheduler1, state1) => { notification.Accept(observer); return(Disposable.Empty); })); } return(Disposable.Create(() => { subscriptions[index] = new Subscription(subscriptions[index].Subscribe, scheduler.Clock); d.Dispose(); })); }
public static void ScheduleRelative <TState>(this TestScheduler @this, TState state, TimeSpan dueTime, Func <IScheduler, TState, IDisposable> action) { @this.ScheduleRelative(state, dueTime.Ticks, action); }
public static void ScheduleRelative(this TestScheduler @this, TimeSpan dueTime, Action action) { @this.ScheduleRelative(dueTime.Ticks, action); }