public void TracksTheDurationOfTheDelay(TimeSpan delay) { var state = new WaitForAWhileState(scheduler, analyticsService); var seconds = (int)delay.TotalSeconds; state.Start(delay.ToPositive()).Subscribe(); scheduler.AdvanceBy(delay.ToPositive().Ticks); analyticsService.RateLimitingDelayDuringSyncing.Received().Track(seconds); }
public void CompletesWhenTheDelayIsOver(TimeSpan delay) { var observer = scheduler.CreateObserver <ITransition>(); var state = new WaitForAWhileState(scheduler, analyticsService); state.Start(delay.ToPositive()).Subscribe(observer); scheduler.AdvanceBy(delay.ToPositive().Ticks); observer.Messages.Should().HaveCount(1); }
public void ReturnsTheContinueTransition(TimeSpan delay) { var observer = scheduler.CreateObserver <ITransition>(); var state = new WaitForAWhileState(scheduler, analyticsService); state.Start(delay.ToPositive()).Subscribe(observer); scheduler.AdvanceBy(delay.ToPositive().Ticks); observer.Messages.First().Value.Value.Result.Should().Be(state.Done); }
public void DoesNotContinueBeforeTheDelayIsOver(TimeSpan delay) { var observer = scheduler.CreateObserver <ITransition>(); var state = new WaitForAWhileState(scheduler, analyticsService); state.Start(delay.ToPositive()).Subscribe(observer); scheduler.AdvanceBy(delay.ToPositive().Ticks - 10); observer.Messages.Should().BeEmpty(); }