Update Tests to use Variables for commandNames
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
$moduleFileName = "ZertoApiWrapper.psm1"
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$commandName = $fileName -replace '.ps1', ''
|
||||
$modulePath = $filePath -replace "Public", ""
|
||||
Import-Module $modulePath\$moduleFileName -Force
|
||||
|
||||
@@ -12,11 +13,11 @@ $credential = New-Object -TypeName System.Management.Automation.PSCredential($us
|
||||
$zertoServer = "192.168.1.100"
|
||||
$zertoPort = "7669"
|
||||
|
||||
Describe "Add-ZertoPeerSite" {
|
||||
Describe "$commandName" {
|
||||
it "file should exist" {
|
||||
"$filePath\$fileName" | should exist
|
||||
}
|
||||
it "module should have a function called Add-ZertoPeerSite" {
|
||||
get-command Add-ZertoPeerSite | should be $true
|
||||
it "module should have a function called $commandName" {
|
||||
get-command $commandName | should be $true
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
$moduleFileName = "ZertoApiWrapper.psm1"
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$commandName = $fileName -replace '.ps1', ''
|
||||
$modulePath = $filePath -replace "Public", ""
|
||||
Import-Module $modulePath\$moduleFileName -Force
|
||||
|
||||
@@ -12,11 +13,11 @@ $credential = New-Object -TypeName System.Management.Automation.PSCredential($us
|
||||
$zertoServer = "192.168.1.100"
|
||||
$zertoPort = "7669"
|
||||
|
||||
Describe "Edit-ZertoVra" {
|
||||
Describe "$commandName" {
|
||||
it "file should exist" {
|
||||
"$filePath\$fileName" | should exist
|
||||
}
|
||||
it "module should have a function called Edit-ZertoVra" {
|
||||
get-command Edit-ZertoVra | should be $true
|
||||
it "module should have a function called $commandName" {
|
||||
get-command $commandName | should be $true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
$moduleFileName = "ZertoApiWrapper.psm1"
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$commandName = $fileName -replace '.ps1', ''
|
||||
$modulePath = $filePath -replace "Public", ""
|
||||
Import-Module $modulePath\$moduleFileName -Force
|
||||
|
||||
@@ -12,11 +13,11 @@ $credential = New-Object -TypeName System.Management.Automation.PSCredential($us
|
||||
$zertoServer = "192.168.1.100"
|
||||
$zertoPort = "7669"
|
||||
|
||||
Describe "Set-ZertoAlert" {
|
||||
Describe "$commandName" {
|
||||
it "file should exist" {
|
||||
"$filePath\$fileName" | should exist
|
||||
}
|
||||
it "module should have a function called Set-ZertoAlert" {
|
||||
get-command Set-ZertoAlert | should be $true
|
||||
it "module should have a function called $commandName" {
|
||||
get-command $commandName | should be $true
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
$moduleFileName = "ZertoApiWrapper.psm1"
|
||||
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||
$commandName = $fileName -replace '.ps1', ''
|
||||
$modulePath = $filePath -replace "Public", ""
|
||||
Import-Module $modulePath\$moduleFileName -Force
|
||||
|
||||
@@ -12,11 +13,11 @@ $credential = New-Object -TypeName System.Management.Automation.PSCredential($us
|
||||
$zertoServer = "192.168.1.100"
|
||||
$zertoPort = "7669"
|
||||
|
||||
Describe "Set-ZertoLicense" {
|
||||
Describe "$commandName" {
|
||||
it "file should exist" {
|
||||
"$filePath\$fileName" | should exist
|
||||
}
|
||||
it "module should have a function called Set-ZertoAlert" {
|
||||
get-command Set-ZertoLicense | should be $true
|
||||
it "module should have a function called $commandName" {
|
||||
get-command $commandName | should be $true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user