test: 移除 TaskTest 文件
This commit is contained in:
parent
4eedb34906
commit
58457c25c8
|
@ -1,47 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
public class TaskTest
|
||||
{
|
||||
private ITestOutputHelper _helper;
|
||||
|
||||
public TaskTest(ITestOutputHelper helper) => _helper = helper;
|
||||
|
||||
[Fact]
|
||||
public async void Task_Ok()
|
||||
{
|
||||
var cts = new CancellationTokenSource(3000);
|
||||
var sw = Stopwatch.StartNew();
|
||||
try
|
||||
{
|
||||
// await Task.Delay(3000, cts.Token);
|
||||
|
||||
await TestAsync(cts.Token);
|
||||
}
|
||||
catch (Exception) { }
|
||||
finally
|
||||
{
|
||||
sw.Stop();
|
||||
}
|
||||
_helper.WriteLine(sw.ElapsedMilliseconds.ToString());
|
||||
|
||||
//var waiter = new CancellationTokenSource(1000);
|
||||
//var task = TestAsync(waiter.Token);
|
||||
//task.Wait(waiter.Token);
|
||||
////try
|
||||
////{
|
||||
//// task.Wait(2000, waiter.Token);
|
||||
////}
|
||||
////catch (Exception) { }
|
||||
//sw.Stop();
|
||||
}
|
||||
|
||||
private Task TestAsync(CancellationToken token) => Task.Delay(2000, token);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue