public void Cancel() { Assert.True(CancellationHelper.Cancel(ref _cts)); Assert.Same(_cts, CancellationHelper.Cancelled); Assert.False(CancellationHelper.Cancel(ref _cts)); }
public void Replace_After_Cancel() { Assert.True(CancellationHelper.Cancel(ref _cts)); var cts = new CancellationTokenSource(); Assert.False(CancellationHelper.Replace(ref _cts, cts)); Assert.True(cts.IsCancellationRequested); }