Skip to content

Commit 6704c3f

Browse files
committed
Correct handling of explicit -Shuffle:$false parameter value in Get-SecureRandom
1 parent 77f1d99 commit 6704c3f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/powershell/Modules/Microsoft.PowerShell.Utility/Get-SecureRandom.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ Describe "Get-SecureRandom" -Tags "CI" {
150150
$randomNumber | Should -BeIn 1, 2, 3, 5, 8, 13
151151
}
152152

153+
It "Should return a single random item when -Shuffle:`$false is used" {
154+
$randomNumber = Get-SecureRandom -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false
155+
$randomNumber.Count | Should -Be 1
156+
$randomNumber | Should -BeIn 1, 2, 3, 5, 8, 13
157+
}
158+
153159
It "Should return for a string collection " {
154160
$randomNumber = Get-SecureRandom -InputObject "red", "yellow", "blue"
155161
$randomNumber | Should -Be ("red" -or "yellow" -or "blue")

0 commit comments

Comments
 (0)