2016-04-06 10:17:27 +02:00
|
|
|
Describe "Start-Sleep DRT Unit Tests" -Tags DRT{
|
2016-04-08 05:27:04 +02:00
|
|
|
It "Should be works properly when sleeping with Second" {
|
2016-04-06 10:17:27 +02:00
|
|
|
$dtStart = [DateTime]::Now
|
|
|
|
Start-Sleep -Seconds 1
|
|
|
|
$dtEnd = [DateTime]::Now
|
|
|
|
$millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds
|
|
|
|
$millseconds | Should BeGreaterThan 1000
|
|
|
|
}
|
|
|
|
|
2016-04-08 05:27:04 +02:00
|
|
|
It "Should be works properly when sleeping with Milliseconds" {
|
2016-04-06 10:17:27 +02:00
|
|
|
$dtStart = [DateTime]::Now
|
|
|
|
Start-Sleep -Milliseconds 1000
|
|
|
|
$dtEnd = [DateTime]::Now
|
|
|
|
$millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds
|
|
|
|
$millseconds | Should BeGreaterThan 1000
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-19 07:23:31 +01:00
|
|
|
Describe "Start-Sleep" {
|
|
|
|
|
|
|
|
Context "Validate Start-Sleep works properly" {
|
2016-03-04 23:52:27 +01:00
|
|
|
It "Should only sleep for at least 1 second" {
|
|
|
|
$result = Measure-Command { Start-Sleep -s 1 }
|
|
|
|
$result.TotalSeconds | Should BeGreaterThan 0.25
|
|
|
|
}
|
2015-11-19 07:23:31 +01:00
|
|
|
}
|
|
|
|
}
|