< Summary - Kestrun — Combined Coverage

Information
Class: Private.Routing._KrMerge-MRO
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Routing/_KrMerge-MRO.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 23
Coverable lines: 23
Total lines: 51
Line coverage: 0%
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 09/05/2025 - 01:20:27 Line coverage: 81.8% (18/22) Total lines: 49 Tag: Kestrun/Kestrun@307328b32323080f64e2bbfdbf3f7087235cf22d10/13/2025 - 16:52:37 Line coverage: 0% (0/23) Total lines: 51 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Routing/_KrMerge-MRO.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Merges two MapRouteOptions objects.
 4    .DESCRIPTION
 5        This function takes two MapRouteOptions objects and merges them into a single object.
 6        The properties from the parent object will be preserved, and the properties from the child
 7        object will override any matching properties in the parent object.
 8    .PARAMETER Parent
 9        The parent MapRouteOptions object.
 10    .PARAMETER Child
 11        The child MapRouteOptions object.
 12    .OUTPUTS
 13        Kestrun.Hosting.Options.MapRouteOptions
 14#>
 15function _KrMerge-MRO {
 16    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseApprovedVerbs', '')]
 17    param(
 18        [Parameter(Mandatory)][Kestrun.Hosting.Options.MapRouteOptions]$Parent,
 19        [Parameter(Mandatory)][Kestrun.Hosting.Options.MapRouteOptions]$Child
 20    )
 021    $pattern = if ($Child.Pattern) {
 022        if ($Parent.Pattern) { "$($Parent.Pattern)/$($Child.Pattern)" } else { $Child.Pattern }
 023    } else { $Parent.Pattern }
 24
 025    $extraRefs = if ($null -ne $Child.ScriptCode.ExtraRefs) {
 026        if ($Parent.ScriptCode.ExtraRefs) {
 027            $Parent.ScriptCode.ExtraRefs + $Child.ScriptCode.ExtraRefs
 28        } else {
 029            $Child.ScriptCode.ExtraRefs
 30        }
 031    } else { $Parent.ScriptCode.ExtraRefs }
 32
 033    $merged = @{
 034        Pattern = $pattern.Replace('//', '/')
 035        HttpVerbs = if ($null -ne $Child.HttpVerbs -and ($Child.HttpVerbs.Count -gt 0)) { $Child.HttpVerbs } else { $Par
 036        RequireSchemes = _KrMerge-Unique $Parent.RequireSchemes $Child.RequireSchemes
 037        RequirePolicies = _KrMerge-Unique $Parent.RequirePolicies $Child.RequirePolicies
 038        CorsPolicyName = if ($Child.CorsPolicyName) { $Child.CorsPolicyName } else { $Parent.CorsPolicyName }
 039        OpenAPI = if ($Child.OpenAPI) { $Child.OpenAPI } else { $Parent.OpenAPI }
 040        ThrowOnDuplicate = $Child.ThrowOnDuplicate -or $Parent.ThrowOnDuplicate
 041        ScriptCode = @{
 042            Code = if ($Child.ScriptCode.Code) { $Child.ScriptCode.Code } else { $Parent.ScriptCode.Code }
 043            Language = if ($null -ne $Child.ScriptCode.Language) { $Child.ScriptCode.Language } else { $Parent.ScriptCod
 044            ExtraImports = _KrMerge-Unique $Parent.ScriptCode.ExtraImports $Child.ScriptCode.ExtraImports
 045            ExtraRefs = $extraRefs
 046            Arguments = _KrMerge-Args $Parent.ScriptCode.Arguments $Child.ScriptCode.Arguments
 47        }
 48    }
 049    return New-KrMapRouteOption -Property $merged
 50}
 51

Methods/Properties

_KrMerge-MRO()