Skip to content

Commit

Permalink
Pester testing for Dynamic Distribution Group PF Mailboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed Oct 4, 2023
1 parent 2dedf60 commit aac3713
Show file tree
Hide file tree
Showing 9 changed files with 2,421 additions and 3 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Describe "Testing Health Checker by Mock Data Imports - Exchange 2013" {
TestObjectMatch "MAPI/HTTP Enabled" "True"
TestObjectMatch "Enable Download Domains" "Unknown"
TestObjectMatch "AD Split Permissions" "False"
TestObjectMatch "Dynamic Distribution Group Public Folder Mailboxes Count" 1 -WriteType "Green"

$Script:ActiveGrouping.Count | Should -Be 5
$Script:ActiveGrouping.Count | Should -Be 6
}

It "Display Results - Operating System Information" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Describe "Testing Health Checker by Mock Data Imports - Exchange 2016" {
TestObjectMatch "MAPI/HTTP Enabled" "True"
TestObjectMatch "Enable Download Domains" "False"
TestObjectMatch "AD Split Permissions" "False"
TestObjectMatch "Dynamic Distribution Group Public Folder Mailboxes Count" 1 -WriteType "Green"

$Script:ActiveGrouping.Count | Should -Be 4
$Script:ActiveGrouping.Count | Should -Be 5
}

It "Display Results - Operating System Information" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Describe "Testing Health Checker by Mock Data Imports" {
TestObjectMatch "MAPI/HTTP Enabled" "True"
TestObjectMatch "Enable Download Domains" "False"
TestObjectMatch "AD Split Permissions" "False"
TestObjectMatch "Dynamic Distribution Group Public Folder Mailboxes Count" 1 -WriteType "Green"

$Script:ActiveGrouping.Count | Should -Be 4
$Script:ActiveGrouping.Count | Should -Be 5
}

It "Display Results - Operating System Information" {
Expand Down Expand Up @@ -165,10 +166,16 @@ Describe "Testing Health Checker by Mock Data Imports" {
Mock Get-WebSite -ParameterFilter { $Name -eq "Default Web Site" } -MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\IIS\GetWebSite_DefaultWebSite1.xml" }
Mock Get-WebConfigFile -ParameterFilter { $PSPath -eq "IIS:\Sites\Default Web Site" } -MockWith { return [PSCustomObject]@{ FullName = "$Script:MockDataCollectionRoot\Exchange\IIS\DefaultWebSite_web2.config" } }
Mock Invoke-ScriptBlockHandler -ParameterFilter { $ScriptBlockDescription -eq "Getting applicationHost.config" } -MockWith { return Get-Content "$Script:MockDataCollectionRoot\Exchange\IIS\applicationHost2.config" -Raw }
Mock Get-DynamicDistributionGroup { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetDynamicDistributionGroupPfMailboxes1.xml" }

SetDefaultRunOfHealthChecker "Debug_Physical_Results.xml"
}

It "Dynamic Public Folder Mailboxes" {
SetActiveDisplayGrouping "Organization Information"
TestObjectMatch "Dynamic Distribution Group Public Folder Mailboxes Count" 2 -WriteType "Red"
}

It "Extended Protection Enabled" {
SetActiveDisplayGrouping "Exchange Information"
TestObjectMatch "Version" "Exchange 2019 CU12 Feb23SU"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Describe "Testing Health Checker by Mock Data Imports" {
Mock Get-AcceptedDomain { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetAcceptedDomain.xml" }
Mock Get-ReceiveConnector { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetReceiveConnector.xml" }
Mock Get-SendConnector { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetSendConnector.xml" }
Mock Get-DynamicDistributionGroup { return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetDynamicDistributionGroupPfMailboxes.xml" }

$Error.Clear()
Get-OrganizationInformation -EdgeServer $false | Out-Null
Expand Down Expand Up @@ -90,6 +91,7 @@ Describe "Testing Health Checker by Mock Data Imports" {
Assert-MockCalled Get-IISModules -Exactly 1
Assert-MockCalled Get-ExchangeDiagnosticInfo -Exactly 1
Assert-MockCalled Get-ExchangeADSplitPermissionsEnabled -Exactly 1
Assert-MockCalled Get-DynamicDistributionGroup -Exactly 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ function Get-OrganizationConfig {
return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetOrganizationConfig.xml"
}

function Get-DynamicDistributionGroup {
return Import-Clixml "$Script:MockDataCollectionRoot\Exchange\GetDynamicDistributionGroupPfMailboxes.xml"
}

function Get-HybridConfiguration { return $null }

# Needs to be a function as PS core doesn't have -ComputerName parameter
Expand Down

0 comments on commit aac3713

Please sign in to comment.