mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Start-Sleep: add 'ms' alias to '-Milliseconds' (#4039)
This commit is contained in:
committed by
Dongbo Wang
parent
a8f9826f08
commit
437d773597
@@ -54,6 +54,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// </summary>
|
||||
[Parameter(Mandatory = true, ParameterSetName = "Milliseconds", ValueFromPipelineByPropertyName = true)]
|
||||
[ValidateRangeAttribute(0, int.MaxValue)]
|
||||
[Alias("ms")]
|
||||
public int Milliseconds { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,6 +9,7 @@ Describe "Start-Sleep DRT Unit Tests" -Tags "CI" {
|
||||
Start-Sleep -Seconds 1
|
||||
$watch.Stop()
|
||||
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
|
||||
$watch.ElapsedMilliseconds | Should BeLessThan 1050
|
||||
}
|
||||
|
||||
It "Should work properly when sleeping with Milliseconds" {
|
||||
@@ -16,6 +17,15 @@ Describe "Start-Sleep DRT Unit Tests" -Tags "CI" {
|
||||
Start-Sleep -Milliseconds 1000
|
||||
$watch.Stop()
|
||||
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
|
||||
$watch.ElapsedMilliseconds | Should BeLessThan 1050
|
||||
}
|
||||
|
||||
It "Should work properly when sleeping with ms alias" {
|
||||
$watch = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
Start-Sleep -ms 1000
|
||||
$watch.Stop()
|
||||
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
|
||||
$watch.ElapsedMilliseconds | Should BeLessThan 1050
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user