예제 #1
0
        static async Task Sleeper(Verify verify)
        {
            verify.WriteLine("Before");
            await Task.Delay(1000);

            verify.WriteLine("After");
        }
예제 #2
0
        static async Task NumericSleeper(Verify verify, int i)
        {
            verify.WriteLine("Before " + i);
            await Task.Delay(1000);

            verify.WriteLine("After " + i);
        }
예제 #3
0
 static Task SleeperManualStart(Verify verify)
 {
     return(new Task(() =>
     {
         verify.WriteLine("Before");
         Thread.Sleep(1000);
         verify.WriteLine("After");
     }));
 }
예제 #4
0
 static Task NumericSleeperManualStart(Verify verify, int i)
 {
     return(new Task(() =>
     {
         verify.WriteLine("Before " + i);
         Thread.Sleep(1000);
         verify.WriteLine("After " + i);
     }));
 }
예제 #5
0
        static async Task LongSleeper(Verify verify, CancellationToken token)
        {
            verify.WriteLine("Before");
            for (var i = 0; i < 10; i++)
            {
                await Task.Delay(1000);

                token.ThrowIfCancellationRequested();
            }
            verify.WriteLine("After");
        }
예제 #6
0
 static async Task LongSleeper(Verify verify, CancellationToken token)
 {
     verify.WriteLine("Before");
     for (var i = 0; i < 10; i++)
     {
         await Task.Delay(1000);
         token.ThrowIfCancellationRequested();
     }
     verify.WriteLine("After");
 }
예제 #7
0
 static async Task Sleeper(Verify verify)
 {
     verify.WriteLine("Before");
     await Task.Delay(1000);
     verify.WriteLine("After");
 }
예제 #8
0
 static Task NumericSleeperManualStart(Verify verify, int i)
 {
     return new Task(() =>
     {
         verify.WriteLine("Before " + i);
         Thread.Sleep(1000);
         verify.WriteLine("After " + i);
     });
 }
예제 #9
0
 static Task SleeperManualStart(Verify verify)
 {
     return new Task(() =>
     {
         verify.WriteLine("Before");
         Thread.Sleep(1000);
         verify.WriteLine("After");
     });
 }
예제 #10
0
 static async Task NumericSleeper(Verify verify, int i)
 {
     verify.WriteLine("Before " + i);
     await Task.Delay(1000);
     verify.WriteLine("After " + i);
 }