< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Logging.Data.InvocationInfoWrapper
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Data/InvocationInfoWrapper.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 90
Line coverage: 100%
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

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%22100%
get_BoundParameters()100%11100%
get_CommandOrigin()100%11100%
get_DisplayScriptPosition()100%11100%
get_ExpectingInput()100%11100%
get_HistoryId()100%11100%
get_InvocationName()100%11100%
get_Line()100%11100%
get_MyCommand()100%11100%
get_OffsetInLine()100%11100%
get_PipelineLength()100%11100%
get_PipelinePosition()100%11100%
get_PositionMessage()100%11100%
get_PSCommandPath()100%11100%
get_PSScriptRoot()100%11100%
get_ScriptLineNumber()100%11100%
get_ScriptName()100%11100%
get_UnboundArguments()100%11100%
ToString()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Data/InvocationInfoWrapper.cs

#LineLine coverage
 1using System.Management.Automation;
 2using System.Management.Automation.Language;
 3using Kestrun.Logging.Enrichers.Extensions;
 4
 5namespace Kestrun.Logging.Data;
 6
 7/// <summary>
 8/// Wraps the PowerShell InvocationInfo object and exposes its properties for logging purposes.
 9/// </summary>
 10/// <remarks>
 11/// Initializes a new instance of the <see cref="InvocationInfoWrapper"/> class with the specified <see cref="Invocation
 12/// </remarks>
 13/// <param name="invocationInfo">The PowerShell <see cref="InvocationInfo"/> object to wrap.</param>
 414public class InvocationInfoWrapper(InvocationInfo invocationInfo)
 15{
 16    /// <summary>
 17    /// Gets the dictionary of bound parameters for the PowerShell invocation.
 18    /// </summary>
 819    public Dictionary<string, object> BoundParameters { get; } = invocationInfo.BoundParameters;
 20    /// <summary>
 21    /// Gets the origin of the command (e.g., Runspace, Internal, etc.).
 22    /// </summary>
 723    public CommandOrigin CommandOrigin { get; } = invocationInfo.CommandOrigin;
 24    /// <summary>
 25    /// Gets the script extent that displays the position of the command in the script.
 26    /// </summary>
 727    public IScriptExtent DisplayScriptPosition { get; } = invocationInfo.DisplayScriptPosition;
 28    /// <summary>
 29    /// Gets a value indicating whether the command is expecting input.
 30    /// </summary>
 731    public bool ExpectingInput { get; } = invocationInfo.ExpectingInput;
 32    /// <summary>
 33    /// Gets the history ID of the PowerShell invocation.
 34    /// </summary>
 735    public long HistoryId { get; } = invocationInfo.HistoryId;
 36    /// <summary>
 37    /// Gets the name of the command being invoked.
 38    /// </summary>
 839    public string InvocationName { get; } = invocationInfo.InvocationName;
 40    /// <summary>
 41    /// Gets the line of the script where the command is invoked.
 42    /// </summary>
 843    public string Line { get; } = invocationInfo.Line;
 44    /// <summary>
 45    /// Gets the string representation of the command being invoked.
 46    /// </summary>
 747    public string? MyCommand { get; } = invocationInfo.MyCommand?.ToString();
 48    /// <summary>
 49    /// Gets the offset in the line where the command is invoked.
 50    /// </summary>
 751    public int OffsetInLine { get; } = invocationInfo.OffsetInLine;
 52    /// <summary>
 53    /// Gets the length of the pipeline for the PowerShell invocation.
 54    /// </summary>
 755    public int PipelineLength { get; } = invocationInfo.PipelineLength;
 56    /// <summary>
 57    /// Gets the position of the command in the pipeline for the PowerShell invocation.
 58    /// </summary>
 759    public int PipelinePosition { get; } = invocationInfo.PipelinePosition;
 60    /// <summary>
 61    /// Gets the position message for the PowerShell invocation.
 62    /// </summary>
 763    public string PositionMessage { get; } = invocationInfo.PositionMessage;
 64    /// <summary>
 65    /// Gets the path of the PowerShell command being executed.
 66    /// </summary>
 767    public string PSCommandPath { get; } = invocationInfo.PSCommandPath;
 68    /// <summary>
 69    /// Gets the script root path of the PowerShell script being executed.
 70    /// </summary>
 771    public string PSScriptRoot { get; } = invocationInfo.PSScriptRoot;
 72    /// <summary>
 73    /// Gets the line number in the script where the command is invoked.
 74    /// </summary>
 875    public int ScriptLineNumber { get; } = invocationInfo.ScriptLineNumber;
 76    /// <summary>
 77    /// Gets the name of the script where the command is invoked.
 78    /// </summary>
 779    public string ScriptName { get; } = invocationInfo.ScriptName;
 80    /// <summary>
 81    /// Gets the list of arguments that were not bound to parameters during the PowerShell invocation.
 82    /// </summary>
 883    public List<object> UnboundArguments { get; } = invocationInfo.UnboundArguments;
 84
 85    /// <summary>
 86    /// Returns a string representation of the <see cref="InvocationInfoWrapper"/> object.
 87    /// </summary>
 88    /// <returns>A string representation of the current object.</returns>
 189    public override string ToString() => this.ToTable();
 90}