From 437d77359744218ab296b0fc65ee834c3b371f5b Mon Sep 17 00:00:00 2001 From: Tadas Medisauskas Date: Mon, 19 Jun 2017 20:15:31 +0100 Subject: [PATCH] Start-Sleep: add 'ms' alias to '-Milliseconds' (#4039) --- .../commands/utility/StartSleepCommand.cs | 1 + .../Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1 | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs index 72e1ec4e3b..8006470e23 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs @@ -54,6 +54,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(Mandatory = true, ParameterSetName = "Milliseconds", ValueFromPipelineByPropertyName = true)] [ValidateRangeAttribute(0, int.MaxValue)] + [Alias("ms")] public int Milliseconds { get; set; } #endregion diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1 index ed0766ac7d..a67eaaa868 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1 @@ -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 } }