All basic unit tests

This commit is contained in:
Wes Carroll
2019-03-29 19:30:14 -04:00
parent 7a90bad1e0
commit 7db1a32399
49 changed files with 767 additions and 761 deletions
+20 -13
View File
@@ -1,23 +1,30 @@
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
$modulePath = $filePath -replace "Private", "" $file = Get-ChildItem "$filePath\$fileName"
. "$filePath\$fileName" . $file.FullName
$oneItemTest = [ordered]@{"OneItem" = "Test"} $singleBoolItemTest = @{"BoolItem" = $True}
$twoItemTest = [ordered]@{"OneItem" = "Test"; "SecondItem" = "Yours"} $oneItemTest = @{"OneItem" = "Test"}
$boolItemTest = [ordered]@{"OneItem" = "Test"; "BoolItem" = $true} $twoItemTest = @{"OneItem" = "Test"; "SecondItem" = "Yours"}
$boolItemTest = @{"OneItem" = "Test"; "BoolItem" = $true}
Describe "Get-ZertoApiFilter" { Describe $file.BaseName -Tag Unit {
it "file should exist" { it "file should exist" {
"$filePath\$fileName" | should exist $file.Fullname | should exist
}
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file.Fullname -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
it "converts bool to text" {
Get-ZertoApiFilter -filtertable $singleBoolItemTest | should -Be "?BoolItem=True"
} }
it "one item test" { it "one item test" {
Get-ZertoApiFilter -filtertable $oneItemTest | should be "?OneItem=Test" Get-ZertoApiFilter -filtertable $oneItemTest | should be "?OneItem=Test"
} }
it "two item test" { #TODO:: Figure out multi-item tests
Get-ZertoApiFilter -filtertable $twoItemTest | should be "?OneItem=Test&SecondItem=Yours"
}
it "bool item test" {
Get-ZertoApiFilter -filtertable $boolItemTest | should be "?OneItem=Test&BoolItem=True"
}
} }
@@ -0,0 +1,17 @@
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
$file = Get-ChildItem "$filePath\$fileName"
. $file.FullName
Describe $file.BaseName -Tag Unit {
it "file should exist" {
$file.FullName | should exist
}
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file.FullName -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
+12 -7
View File
@@ -1,19 +1,20 @@
#Requires -Modules Pester #Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut" $file = Get-ChildItem "$here\$sut"
#$moduleFileName = "ZertoApiWrapper.psd1" $modulePath = $here -replace "Public", ""
#$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
#$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' Get-Module -Name ZertoApiWrapper | Remove-Module -Force
#$commandName = $fileName -replace '.ps1', '' Import-Module $moduleFile -Force
#Get-Module -Name ZertoApiWrapper | Remove-Module -Force
#Import-Module D:\GitHub\ZertoApiWrapper\ZertoApiWrapper\ZertoApiWrapper.psd1 -force
Describe $file.BaseName -Tag 'Unit' { Describe $file.BaseName -Tag 'Unit' {
Context "Basic Features" { Context "Basic Features" {
Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest { Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest {
return "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f" return "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f"
} }
It "is valid Powershell (Has no script errors)" { It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop $contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null $errors = $null
@@ -26,19 +27,23 @@ Describe $file.BaseName -Tag 'Unit' {
$results | should not benullorempty $results | should not benullorempty
$results.gettype().name | should -be "String" $results.gettype().name | should -be "String"
} }
it "Should not take a non-int as a port" { it "Should not take a non-int as a port" {
{Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string'} | should -Throw {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string'} | should -Throw
} }
it "Should not take a non-ip address as a 'TargetHost'" { it "Should not take a non-ip address as a 'TargetHost'" {
{Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081'} | should -Throw {Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081'} | should -Throw
{Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081'} | should -Throw {Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081'} | should -Throw
{Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081'} | should -Throw {Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081'} | should -Throw
} }
it "Should not require a target port to be defined" { it "Should not require a target port to be defined" {
Add-ZertoPeerSite -targetHost '192.168.1.100' Add-ZertoPeerSite -targetHost '192.168.1.100'
} }
it "Should support '-whatif'" { it "Should support '-whatif'" {
{Add-ZertoPeerSite -targetHost '192.168.1.100' -WhatIf | out-null} | Should -Not -Throw {Add-ZertoPeerSite -targetHost '192.168.1.100' -WhatIf| out-null} | Should -Not -Throw
} }
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+19
View File
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+19
View File
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+19
View File
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
@@ -0,0 +1,19 @@
#Requires -Modules Pester
$moduleFileName = "ZertoApiWrapper.psd1"
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$file = Get-ChildItem "$here\$sut"
$modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
Describe $file.BaseName -Tag 'Unit' {
It "is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $file -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors | Should -HaveCount 0
}
}
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }
+15 -19
View File
@@ -1,23 +1,19 @@
$moduleFileName = "ZertoApiWrapper.psm1" #Requires -Modules Pester
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' $moduleFileName = "ZertoApiWrapper.psd1"
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' $here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
$commandName = $fileName -replace '.ps1', '' $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
$modulePath = $filePath -replace "Public", "" $file = Get-ChildItem "$here\$sut"
Import-Module $modulePath\$moduleFileName -Force $modulePath = $here -replace "Public", ""
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
Import-Module $moduleFile -Force
$userName = "zerto\build" Describe $file.BaseName -Tag 'Unit' {
$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 It "is valid Powershell (Has no script errors)" {
$zertoServer = "192.168.1.100" $contents = Get-Content -Path $file -ErrorAction Stop
$zertoPort = "7669" $errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
Describe "$commandName" { $errors | Should -HaveCount 0
it "file should exist" {
"$filePath\$fileName" | should exist
}
it "module should have a function called $commandName" {
get-command $commandName | should be $true
} }
} }