diff --git a/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 new file mode 100644 index 0000000..e9301e0 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'desiredJournalHistory'; Type = 'String'; Mandatory = $true; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 new file mode 100644 index 0000000..5e2b7f6 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'interval'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerSite.Tests.ps1 b/Tests/Public/Get-ZAPlannerSite.Tests.ps1 new file mode 100644 index 0000000..c12a46f --- /dev/null +++ b/Tests/Public/Get-ZAPlannerSite.Tests.ps1 @@ -0,0 +1,42 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 new file mode 100644 index 0000000..bed9818 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 new file mode 100644 index 0000000..238ba22 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 @@ -0,0 +1,56 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 new file mode 100644 index 0000000..bed9818 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAProtectedVm.Tests.ps1 b/Tests/Public/Get-ZAProtectedVm.Tests.ps1 new file mode 100644 index 0000000..89e1e5d --- /dev/null +++ b/Tests/Public/Get-ZAProtectedVm.Tests.ps1 @@ -0,0 +1,41 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'AllVms'; Type = 'Switch'; Mandatory = $false; Validation = $Null } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'Volumes'; Type = 'Switch'; Mandatory = $false; Validation = $Null } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 b/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 new file mode 100644 index 0000000..95ad321 --- /dev/null +++ b/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 @@ -0,0 +1,39 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) +$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + $ParameterTestCases = @( + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global