AccidentalFish.ApplicationSupport.Core.Tests.Unit.Policies.Implementation.AsynchronousIntervalTimerTests.DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken C# (CSharp) Метод

DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken() приватный Метод

private DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken ( ) : Task
Результат Task
        public async Task DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken()
        {
            // Arrange
            Mock<IAsynchronousDelay> delay = new Mock<IAsynchronousDelay>();
            AsynchronousIntervalTimer timer = new AsynchronousIntervalTimer(delay.Object, TimeSpan.FromMilliseconds(PretendDelayInMilliseconds), true);
            CancellationTokenSource source = new CancellationTokenSource();

            // Act
            await timer.ExecuteAsync(ct => Task.FromResult(false), source.Token);

            // Assert
            delay.Verify(x => x.Delay(TimeSpan.FromMilliseconds(PretendDelayInMilliseconds), source.Token));
        }