Esempio n. 1
0
        private ObservableExpectation <T> CreateExpectation <T>(IObservable <T> observable, string unsubscriptionMarbles)
        {
            var expectation         = new ObservableExpectation <T>();
            var unsubscriptionFrame = unsubscriptionMarbles != null
                ? Marbles.ToSubscription(unsubscriptionMarbles).Unsubscribe
                : Subscription.Infinite;

            IDisposable disposable = null;

            this.ScheduleAbsolute(0, () =>
            {
                disposable = observable.Subscribe(
                    x =>
                {
                    expectation.AddNotification(Clock, Notification.CreateOnNext(x));
                },
                    err => expectation.AddNotification(Clock, Notification.CreateOnError <T>(err)),
                    () => expectation.AddNotification(Clock, Notification.CreateOnCompleted <T>()));
            });
            if (unsubscriptionFrame != Subscription.Infinite)
            {
                this.ScheduleAbsolute(unsubscriptionFrame, () => disposable.Dispose());
            }
            return(expectation);
        }
Esempio n. 2
0
 internal ObservableToBe(ObservableExpectation <char> expectation)
 {
     _expectation = expectation;
 }