• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

loresoft / FluentCommand / 36888666826

01 Oct 2026 04:00PM UTC coverage: 61.179% (-4.7%) from 65.903%
36888666826

push

github

pwelter34
Improve MERGE SQL generation and literals

1624 of 3516 branches covered (46.19%)

Branch coverage included in aggregate %.

49 of 70 new or added lines in 1 file covered. (70.0%)

373 existing lines in 32 files now uncovered.

5422 of 8001 relevant lines covered (67.77%)

292.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.5
/src/FluentCommand/Query/QueryParameterNormalizer.cs
1
using System.Text.Json;
2

3
namespace FluentCommand.Query;
4

5
/// <summary>
6
/// Normalizes query parameter values and types before parameter creation.
7
/// </summary>
8
internal static class QueryParameterNormalizer
9
{
10
    /// <summary>
11
    /// Normalizes enum and nullable enum values to their numeric underlying value and type.
12
    /// </summary>
13
    /// <param name="value">The parameter value.</param>
14
    /// <param name="type">The declared parameter type.</param>
15
    /// <returns>
16
    /// A tuple containing the normalized value and type.
17
    /// </returns>
18
    /// <exception cref="ArgumentNullException">Thrown if <paramref name="type"/> is <c>null</c>.</exception>
19
    public static (object? Value, Type Type) Normalize(object? value, Type type)
20
    {
21
        ArgumentNullException.ThrowIfNull(type);
331 ✔
22

23
        if (value is JsonElement element)
331 !
24
        {
UNCOV
25
            type = typeof(string);
×
UNCOV
26
            value = element.ValueKind != JsonValueKind.Undefined
×
UNCOV
27
                ? element.GetRawText()
×
UNCOV
28
                : null;
×
29

UNCOV
30
            return (value, type);
×
31
        }
32

33
        var enumType = Nullable.GetUnderlyingType(type) ?? type;
331 ✔
34
        if (!enumType.IsEnum)
331 !
35
            return (value, type);
331 ✔
36

UNCOV
37
        var underlyingType = Enum.GetUnderlyingType(enumType);
×
UNCOV
38
        if (value is null)
×
UNCOV
39
            return (null, underlyingType);
×
40

UNCOV
41
        return (Convert.ChangeType(value, underlyingType), underlyingType);
×
42
    }
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc