← All Scenarios · Scenario 02

Stop(TimeSpan) Bounded Stop

02
Stop(TimeSpan) Bounded Stop
PASS
Goal
Verify the new Stop(TimeSpan) overload bounds stop time, leaves the instance in Stopped state, and is backwards compatible with the existing Stop() overload.
Trying to break
Calling Stop(short) on a quick-stopping command should not spuriously throw TimeoutException. Stop after Dispose should be silent.
4 test stepsPress Start to walk through the scenario step by step.
View full script source (stop-timeout-overload.ps1)
$ps = [PowerShell]::Create()
$ps.AddScript('Start-Sleep -Seconds 300') > $null
$null = $ps.BeginInvoke()
Start-Sleep -Milliseconds 200

$sw = [System.Diagnostics.Stopwatch]::StartNew()
$ps.Stop([TimeSpan]::FromSeconds(10))
$sw.Stop()
Write-Host "Stopped in $($sw.ElapsedMilliseconds)ms, State=$($ps.InvocationStateInfo.State)"

Linked Requirements

REQ-05 →
← Previous Next →