< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Class: Microsoft.EntityFrameworkCore.Util
Assembly: ZhEaIsNsAaBn.Infrastructure.Core
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.Core/Extensions/Util.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 31
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 14
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsNotEmpty(...)100%210%
IsNotEmptyNumber(...)0%4260%
TrimValue(...)0%7280%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.Core/Extensions/Util.cs

#LineLine coverage
 1// ReSharper disable once CheckNamespace
 2namespace Microsoft.EntityFrameworkCore;
 3
 4/// <summary>Small string checks. Stored-procedure parameter helpers live in the provider package (e.g. <c>SqlServerPara
 5public static class Util
 6{
 7    /// <summary>Checks that a string has text other than whitespace, <c>"null"</c> or <c>"undefined"</c>.</summary>
 8    /// <param name="val">The string.</param>
 9    /// <returns><see langword="true"/> when it has real text.</returns>
 010    public static bool IsNotEmpty( this string? val ) => val.TrimValue() is not null;
 11
 12    /// <summary>Checks that a value is a non-zero whole number.</summary>
 13    /// <param name="val">The value.</param>
 14    /// <returns><see langword="true"/> when it parses as a non-zero <see cref="int"/>.</returns>
 15    public static bool IsNotEmptyNumber( this object? val )
 016        => val?.ToString().TrimValue() is { } text && int.TryParse( text, NumberStyles.Integer, CultureInfo.InvariantCul
 17
 18    /// <summary>Trims a string; whitespace, <c>"null"</c> and <c>"undefined"</c> become <see langword="null"/>.</summar
 19    /// <param name="val">The string.</param>
 20    /// <returns>The trimmed string, or <see langword="null"/>.</returns>
 21    public static string? TrimValue( this string? val )
 22    {
 023        if ( string.IsNullOrWhiteSpace( val ) ) { return null; }
 24
 25
 026        var trimmed = val.Trim();
 27
 28
 029        return trimmed is "null" or "undefined" ? null : trimmed;
 30    }
 31}