ps/Modules/Alkami.PowerShell.Configuration/Public/Get-NetshExcludedPortRanges.Tests.ps1
2023-05-30 22:51:22 -07:00

22 lines
726 B
PowerShell

<#
A note for the maintainer in the future
If this test breaks, it's because the output from Microsoft changed.
We want the parsing to do the right thing.
#>
Describe "Ensure netsh commands match expected output" {
$output = (netsh int ipv4 show excludedportrange protocol=tcp)
$expectedValues = @(
'Protocol tcp Port Exclusion Ranges',
'\* - Administered port exclusions.', # use of \* as we use a -match operator and this is therefore a regex
'Start Port',
'End Port'
)
foreach ($expectedValue in $expectedValues) {
It "Checking for matching case on [$expectedValue] to be present" {
$output -match $expectedValue | Should -Be $true
}
}
}