< Summary - Kestrun — Combined Coverage

Information
Class: Private.Server.Resolve-KestrunServer
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Server/Resolve-KestrunServer.ps1
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
80%
Covered lines: 4
Uncovered lines: 1
Coverable lines: 5
Total lines: 35
Line coverage: 80%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Server/Resolve-KestrunServer.ps1

#LineLine coverage
 1
 2<#
 3.SYNOPSIS
 4    Resolves a Kestrun server instance from the provided input.
 5
 6.DESCRIPTION
 7    The Resolve-KestrunServer function checks if the provided server instance is valid.
 8    If not, it attempts to retrieve the default Kestrun server instance.
 9
 10.PARAMETER Server
 11    The Kestrun server instance to resolve.
 12
 13.EXAMPLE
 14    $resolvedServer = Resolve-KestrunServer -Server $myServer
 15    This will resolve $myServer to a valid Kestrun server instance.
 16
 17.NOTES
 18    If no server is provided, the function will look for the default Kestrun server instance
 19    managed by KestrunHostManager.  If no default instance exists, an error is thrown.
 20    Used inside kestrun cmdlets to ensure a valid server instance is available for operations
 21    as:  $Server = Resolve-KestrunServer -Server $Server
 22#>
 23function Resolve-KestrunServer {
 24    param (
 25        [Kestrun.Hosting.KestrunHost]$Server
 26    )
 127    if ($null -eq $Server) {
 128        $Server = [Kestrun.KestrunHostManager]::Default
 129        if ($null -eq $Server) {
 030            throw 'No Kestrun server instance found. Please create a Kestrun server instance.'
 31        }
 32    }
 133    return $Server
 34}
 35

Methods/Properties

Resolve-KestrunServer()