ps/Modules/Alkami.PowerShell.Services/Public/Start-DependentServices.tests.ps1
2023-05-30 22:51:22 -07:00

28 lines
1019 B
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 "Start-DependentServices" {
Context "Error Handling" {
It "Does Not Throw if the Services to Start Collection is Null" {
Mock -CommandName Get-AlkamiServices -MockWith {
return $null
} -ModuleName $moduleForMock
Mock -CommandName Start-ServicesInParallel -MockWith {} -ModuleName $moduleForMock
{ Start-DependentServices } | Should -Not -Throw
Assert-MockCalled -CommandName Get-AlkamiServices -Times 1 -Scope It -ModuleName $moduleForMock
Assert-MockCalled -CommandName Start-ServicesInParallel -Times 0 -Exactly -Scope It -ModuleName $moduleForMock
}
}
}