有没有办法可以使用 Pester 测试框架创建 OR 断言?

i'i*_*i'i 1 testing powershell unit-testing assertion pester

例如,如果我想断言值应该是 Value1 或 Value2(两者都可以接受):

   It 'Value must match Value1 or Value2' {
         $params.value | Should -be "Value1" || "Value2"
    }`
Run Code Online (Sandbox Code Playgroud)

这是无效的语法 - 有没有办法用 Pester 做到这一点?

Mat*_*sen 6

你想要-BeIn断言

if 'Value must match Value1 or Value 2' {
    $params.Value |Should -BeIn @('Value1','Value2')
}
Run Code Online (Sandbox Code Playgroud)