///
///
///
///
module Rx {
export interface TestScheduler extends VirtualTimeScheduler {
/**
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
*/
createColdObservable(...records: Recorded[]): Observable;
/**
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
*/
createHotObservable(...records: Recorded[]): Observable;
/**
* Creates an observer that records received notification messages and timestamps those.
* @return Observer that can be used to assert the timing of received notifications.
*/
createObserver(): MockObserver;
/**
* Creates a resolved promise with the given value and ticks
* @param {Number} ticks The absolute time of the resolution.
* @param {Any} value The value to yield at the given tick.
* @returns {MockPromise} A mock Promise which fulfills with the given value.
*/
createResolvedPromise(ticks: number, value: T): IPromise;
/**
* Creates a rejected promise with the given reason and ticks
* @param {Number} ticks The absolute time of the resolution.
* @param {Any} reason The reason for rejection to yield at the given tick.
* @returns {MockPromise} A mock Promise which rejects with the given reason.
*/
createRejectedPromise(ticks: number, value: T): IPromise;
/**
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
*
* @param create Factory method to create an observable sequence.
* @param created Virtual time at which to invoke the factory to create an observable sequence.
* @param subscribed Virtual time at which to subscribe to the created observable sequence.
* @param disposed Virtual time at which to dispose the subscription.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithTiming(create: () => Observable, createdAt: number, subscribedAt: number, disposedAt: number): MockObserver;
/**
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
* Default virtual times are used for factory invocation and sequence subscription.
*
* @param create Factory method to create an observable sequence.
* @param disposed Virtual time at which to dispose the subscription.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithDispose(create: () => Observable, disposedAt: number): MockObserver;
/**
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription.
*
* @param create Factory method to create an observable sequence.
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
*/
startWithCreate(create: () => Observable): MockObserver;
}
export var TestScheduler: {
new (): TestScheduler;
}
}
(function() {
var ts : Rx.TestScheduler = new Rx.TestScheduler();
var o : Rx.Observable = ts.createColdObservable(new Rx.Recorded(100, '5'));
var o : Rx.Observable = ts.createHotObservable(new Rx.Recorded(100, '5'));
var ob : Rx.MockObserver = ts.createObserver();
var p : Rx.Promise = ts.createResolvedPromise(100, false);
var p : Rx.Promise = ts.createRejectedPromise(100, false);
var ob = ts.startWithTiming(() => Rx.Observable.create(null), 100, 200, 300);
var ob = ts.startWithDispose(() => Rx.Observable.create(null), 300);
var ob = ts.startWithCreate(() => Rx.Observable.create(null));
});