29 lines
1.2 KiB
PowerShell
29 lines
1.2 KiB
PowerShell
. $PSScriptRoot\..\..\Load-PesterModules.ps1
|
|
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
|
$functionPath = Join-Path -Path $here -ChildPath $sut
|
|
Write-Host "Overriding SUT: $functionPath"
|
|
Import-Module $functionPath -Force
|
|
$moduleForMock = ""
|
|
|
|
Describe "Test-KnownWCFServicesResolvable" {
|
|
Mock -ModuleName $moduleForMock -CommandName Write-Host -MockWith {}
|
|
Mock -ModuleName $moduleForMock -CommandName Write-Error -MockWith {}
|
|
Mock -ModuleName $moduleForMock -CommandName Write-Warning -MockWith {}
|
|
|
|
Mock -ModuleName $moduleForMock -CommandName Get-LogLeadName -MockWith { "UUT" }
|
|
|
|
Context "hosts resolution returns null" {
|
|
It "throws when it can not resolve services" {
|
|
Mock -ModuleName $moduleForMock -CommandName Resolve-DNSName -MockWith { throw "throw" }
|
|
{ Test-KnownWCFServicesResolvable } | Should Throw
|
|
}
|
|
}
|
|
|
|
Context "hosts resolution returns anything" {
|
|
It "does not throw when all services resolve correctly" {
|
|
Mock -ModuleName $moduleForMock -CommandName Resolve-DNSName -MockWith { $true }
|
|
{ Test-KnownWCFServicesResolvable } | Should Not Throw
|
|
}
|
|
}
|
|
} |