< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Logging.Utils.Console.Extensions.TableExtensions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Utils/Console/Extensions/TableExtensions.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 35
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
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
AddPropertyRow(...)100%1010100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Logging/Utils/Console/Extensions/TableExtensions.cs

#LineLine coverage
 1
 2namespace Kestrun.Logging.Utils.Console.Extensions;
 3
 4/// <summary>
 5/// Provides extension methods for the <see cref="Table"/> class.
 6/// </summary>
 7public static class TableExtensions
 8{
 9    /// <summary>
 10    /// Adds one row with two cells into <see cref="Table"/> only if <paramref name="propertyValue"/> is not null or emp
 11    /// </summary>
 12    /// <param name="table"></param>
 13    /// <param name="propertyName"></param>
 14    /// <param name="propertyValue"></param>
 15    public static void AddPropertyRow(this Table table, string propertyName, object propertyValue)
 16    {
 2517        if (propertyValue == null || (propertyValue is string propertyValueString && string.IsNullOrEmpty(propertyValueS
 18        {
 1219            return;
 20        }
 21
 22        // Avoid calling ToString() on non-string values here; Table and Cell will defer formatting.
 23        // Clamp extremely long strings to keep rendering safe and bounded.
 1324        if (propertyValue is string s)
 25        {
 26            const int maxLen = 8_192; // safety cap
 527            var safe = s.Length > maxLen ? s[..maxLen] + "…" : s;
 528            table.AddRow(propertyName, safe);
 29        }
 30        else
 31        {
 832            table.AddRow(propertyName, propertyValue);
 33        }
 834    }
 35}