Powershell 有没有一种方法可以使用Pester测试框架创建一个非此即彼的断言?

Powershell 有没有一种方法可以使用Pester测试框架创建一个非此即彼的断言?,powershell,unit-testing,testing,assertion,pester,Powershell,Unit Testing,Testing,Assertion,Pester,例如,如果我想断言值应为Value1或Value2,则可以接受: It 'Value must match Value1 or Value2' { $params.value | Should -be "Value1" || "Value2" }` 这是无效的语法-有没有办法用Pester做到这一点?您想要: 您想要: if 'Value must match Value1 or Value 2' { $param

例如,如果我想断言值应为Value1或Value2,则可以接受:

   It 'Value must match Value1 or Value2' {
         $params.value | Should -be "Value1" || "Value2"
    }`
这是无效的语法-有没有办法用Pester做到这一点?

您想要:

您想要:

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