mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Respect -Shuffle:$false in Get-Random (#26457)
This commit is contained in:
@@ -162,6 +162,12 @@ Describe "Get-Random" -Tags "CI" {
|
||||
$randomNumber | Should -BeIn 1, 2, 3, 5, 8, 13
|
||||
}
|
||||
|
||||
It "Should return a single random item when -Shuffle:`$false is used" {
|
||||
$randomNumber = Get-Random -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false
|
||||
$randomNumber.Count | Should -Be 1
|
||||
$randomNumber | Should -BeIn 1, 2, 3, 5, 8, 13
|
||||
}
|
||||
|
||||
It "Should return for a string collection " {
|
||||
$randomNumber = Get-Random -InputObject "red", "yellow", "blue"
|
||||
$randomNumber | Should -Be ("red" -or "yellow" -or "blue")
|
||||
|
||||
Reference in New Issue
Block a user