Exemplo n.º 1
0
        public async Task Test_await_Task_result()
        {
            var sut = new Concurrency();
            // Also unlike Go's goroutine, Task can 'returns' result after the task completed.
            var result = await sut.BenchmarkSayAsync("Hi", TimeSpan.FromMilliseconds(5));

            // note: there's always overhead to run async operations.
            Assert.True(result > TimeSpan.FromMilliseconds(25));
        }