diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs index 72e1ec4e3b1..8006470e231 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 @@ public void Dispose() /// [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 ed0766ac7db..a67eaaa8683 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 } }