大家好我有一個書面的示例腳本查找給定的字符串是否是迴文與否如下一個示例腳本糾纏PowerShell的測試工作不正常
function Palindrome1([string] $param)
{
[string] $ReversString
$StringLength = @()
$StringLength = $param.Length
while ($StringLength -ge 0)
{
$ReversString = $ReversString + $param[$StringLength]
$StringLength--
}
if($ReversString -eq $param)
{
return $true
}
else
{
return $false
}
}
這是我.tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Palindrome1" {
It "does something useful" {
Palindrome1 "radar" | Should Be $true
}
}
下面是調用腳本
$modulePath = "D:\Pester-master\Pester.psm1"
$SourceDir = "E:\Pester"
Import-Module $modulePath -ErrorAction Inquire
$outputFile = Join-Path $SourceDir "TEST-pester.xml"
$result = Invoke-Pester -Path $SourceDir -CodeCoverage "$SourceDir\*.ps1" -PassThru -OutputFile $outputFile
$result
我沒有得到預期的結果可以有一個人告訴我哪裏做錯了
你看到了什麼結果? – Kirill
在我的xml我得到如下'預計:{真實} 但是:{} ' –
Dotnet