/// <summary> /// Cancel the test after the specified timeout. /// </summary> /// <param name="timeout"> /// A <see cref="TimeSpan"/> representing the timeout period. /// </param> /// <param name="whenDebugging"> /// Schedule cancellation, even if a debugger is attached? /// </param> protected void TestTimeout(TimeSpan timeout, bool whenDebugging = false) { if (whenDebugging || !Debugger.IsAttached) { TestCancellationSource.CancelAfter(timeout); } }
/// <summary> /// Cancel the test cancellation token. /// </summary> protected void CancelTest() => TestCancellationSource.Cancel();