Dotnet, Development, C Sharp Programming, Csharp, Microsoft.
noDelayTimeProvider.GetUtcNow(); await demoService.MethodWithDelay(); var endTime = noDelayTimeProvider.GetUtcNow(); // Assert var elapsedSeconds = (endTime - startTime).Seconds; elapsedSeconds.Should().Be(0); } You can also achieve similar results when using the Task.WaitAsync, which also receives