Update Tests to use Variables for commandNames

This commit is contained in:
Wes Carroll
2019-03-01 19:49:43 -05:00
parent 7d24204c69
commit 05af10f365
4 changed files with 17 additions and 13 deletions
+4 -3
View File
@@ -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
}
}
+5 -4
View File
@@ -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
}
}
}
+4 -3
View File
@@ -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
}
}
+4 -3
View File
@@ -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
}
}