AccidentalFish.ApplicationSupport.Core.Tests.Unit.Policies.Implementation.AsynchronousIntervalTimerTests.DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken C# (CSharp) 메소드

DelayOnExecuteWaitsForIntervalBeforeFirstTaskWithCancellationToken() 개인적인 메소드

        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));
        }