public void GetResult_Cancel_Negative1() { IDisposable disposableToken = null; try { var implement = new Implement(); TaskResponse response = implement.CreateTask(50); disposableToken = response.CancelProvider; Thread.Sleep(100); response.CancelProvider.Cancel(); int result = implement.GetTaskResult(response.Task); Assert.Equal(-1, result); } finally { if (disposableToken != null) { disposableToken.Dispose(); } } }
public void GetResult_40_40() { IDisposable disposableToken = null; try { var implement = new Implement(); TaskResponse response = implement.CreateTask(40); disposableToken = response.CancelProvider; int result = implement.GetTaskResult(response.Task); Assert.Equal(40, result); } finally { if (disposableToken != null) { disposableToken.Dispose(); } } }