Files
ZertoApiWrapper/Tests/Public/ZertoApiWrapper.Tests.ps1
T
2019-03-27 07:51:49 -04:00

38 lines
1.6 KiB
PowerShell

$moduleName = "ZertoApiWrapper"
$moduleFileName = "ZertoApiWrapper.psm1"
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
$docsPath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests/Public', 'docs'
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
$modulePath = $filePath -replace "Public", ""
$userName = "zerto\build"
$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password)
# $credential = Import-Clixml -Path C:\ZertoScripts\Creds.xml
$zertoServer = "192.168.1.100"
$zertoPort = "7669"
Import-Module $modulePath\$moduleFileName
Describe "File Tests" {
Remove-Module $moduleName -Force
Import-Module $modulePath\$moduleFileName
$commands = Get-Command -Module $moduleName | Select-Object -ExpandProperty Name
foreach ($command in $commands) {
$externalHelpFile = "{0}/{1}.md" -f $docsPath, $command
$path = "{0}/{1}.ps1" -f $filePath, $command
context "$command File Tests" {
it "$command is backed by a file with the same name" {
$path | should exist
}
it "$command has an external help file" {
$externalHelpFile | should exist
}
it "$command has the External Help File Defined" {
Get-Content -Path $path -First 1 | should be "<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>"
}
}
}
}