public async Task IntervalOccursBetweenTasksWithoutCancellationToken()
{
// Arrange
Mock<IAsynchronousDelay> delay = new Mock<IAsynchronousDelay>();
AsynchronousIntervalTimer timer = new AsynchronousIntervalTimer(delay.Object, TimeSpan.FromMilliseconds(PretendDelayInMilliseconds), false);
int repeatCount = 0;
// Act
await timer.ExecuteAsync(() =>
{
repeatCount++;
return Task.FromResult(repeatCount < 2);
});
// Assert
Assert.AreEqual(2, repeatCount);
delay.Verify(x => x.Delay(TimeSpan.FromMilliseconds(PretendDelayInMilliseconds)));
}