Example #1
0
            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);
            }
Example #2
0
            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);
            }
Example #3
0
            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);
            }
Example #4
0
            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();
            }