Tests/Unit/Public/Authentication/Get-SCASession.Tests.ps1
|
Import-Module (Join-Path $PSScriptRoot '../../../../psSCA.psd1') -Force Describe 'Get-SCASession' { InModuleScope psSCA { BeforeEach { $script:SCASessions = [ordered]@{ Default = [pscustomobject]@{ PSTypeName = 'psSCA.Session'; Name = 'Default' } Production = [pscustomobject]@{ PSTypeName = 'psSCA.Session'; Name = 'Production' } } $script:SCACurrentSessionName = 'Default' } It 'returns every active session when -Name is omitted' { $result = @(Get-SCASession) $result.Count | Should -Be 2 } It 'returns only the named session when -Name is specified' { $result = Get-SCASession -Name 'Production' $result.Name | Should -Be 'Production' } It 'returns nothing for a name that does not exist' { Get-SCASession -Name 'Missing' | Should -BeNullOrEmpty } } } |