无法处理参数'Tests'的参数转换

时间:2017-04-25 19:15:09

标签: powershell

无法将值转换为System.String类型:ParameterArgumentTransformationError

Param(
    # Use this flag to attach a debugger
    [switch]$AttachDebugger,

    # Use this flag to run the test outside of razzle window (in which case, all required file should be in the same dir)
    [switch]$NoRazzle,

    # Optional test specifier.
    [ValidateNotNullOrEmpty()]
    [string]$Tests,

    # Optional category
    [ValidateNotNullOrEmpty()]
    [string]$Category
)

$command = "Run-Tests.ps1"
$arguments = @("-Type", "Group")
if($AttachDebugger)
{
    $arguments += ("-AttachDebugger")
}
if($NoRazzle)
{
    $arguments += ("-NoRazzle")
}
if (![string]::IsNullOrWhiteSpace($Category))
{
    $arguments += ("-Category", "$Category")
}
if (![string]::IsNullOrWhiteSpace($Tests))
{
    $arguments += ("-Tests", "$Tests")
}
& "$PSScriptRoot\Run-Tests" $arguments

$ Run-Tests中的测试是数据类型字符串。如何解决这个问题?

0 个答案:

没有答案