powershell - Is there a way I can create an either OR assertion using Pester test framework?
问题描述
For example if I wanted to assert the value should be Value1 or Value2 (either is acceptable):
It 'Value must match Value1 or Value2' {
$params.value | Should -be "Value1" || "Value2"
}`
This is invalid syntax - is there a way to do this with Pester?
解决方案
你想要-BeIn
断言:
if 'Value must match Value1 or Value 2' {
$params.Value |Should -BeIn @('Value1','Value2')
}
推荐阅读
- amazon-web-services - 未找到代码管道匹配的工件
- javascript - 如何从 React JS UI 向节点 js 服务提交输入
- java - 字符串位于另一个字符串之上的 TextArea
- reactjs - Stripe connect 服务,如何保存返回 id
- sql - 在不添加新列的情况下替换选择?
- javascript - 任何 JS 专家都可以查看我的代码并告诉我做错了什么吗
- django-rest-framework - DRF - Djoser 对所有请求返回 Unauthorized
- python - ValueError:从 json 文件读取时未正确调用 DataFrame 构造函数
- c# - 远程 Visual Studio 性能分析器获取代码行 C#
- react-native - 为什么我的 React Native View 高度不一致?