Start-Sleep: add 'ms' alias to '-Milliseconds' (#4039)

This commit is contained in:
Tadas Medisauskas
2017-06-19 12:15:31 -07:00
committed by Dongbo Wang
parent a8f9826f08
commit 437d773597
2 changed files with 11 additions and 0 deletions
@@ -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
}
}