private void ChangeStateTo(VostokApplicationState newState, Exception error = null) { ApplicationState = newState; onApplicationStateChanged.Next(newState); if (error != null) { onApplicationStateChanged.Error(error); } else if (newState.IsTerminal()) { onApplicationStateChanged.Complete(); } }
public void Subscribe_should_pass_latest_value_to_observer_immediately() { observable.Next("1"); observable.Next("2"); observable.Subscribe(observer1); observer1.ReceivedCalls().Should().HaveCount(1); observer1.Received().OnNext("2"); }
public PeriodicObservable(Func <T> valueProvider, TimeSpan period) { baseObservable = new CachingObservable <T>(); updateAction = new PeriodicalAction(() => baseObservable.Next(valueProvider()), _ => {}, () => period); }