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

loresoft / FluentCommand / 26594173245

28 May 2026 06:28PM UTC coverage: 55.553% (+0.7%) from 54.902%
26594173245

push

github

pwelter34
Move JSON support, add docs and examples

1358 of 3215 branches covered (42.24%)

Branch coverage included in aggregate %.

103 of 234 new or added lines in 9 files covered. (44.02%)

371 existing lines in 26 files now uncovered.

4389 of 7130 relevant lines covered (61.56%)

312.89 hits per line

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

66.67
/src/FluentCommand/Extensions/TypeExtensions.cs
1
namespace FluentCommand.Extensions;
2

3
/// <summary>
4
/// <see cref="T:Type"/> extension methods.
5
/// </summary>
6
public static class TypeExtensions
7
{
8
    /// <summary>
9
    /// Gets the underlying type dealing with <see cref="T:Nullable`1"/>.
10
    /// </summary>
11
    /// <param name="type">The type.</param>
12
    /// <returns>Returns a type dealing with <see cref="T:Nullable`1"/>.</returns>
13
    public static Type GetUnderlyingType(this Type type)
14
    {
15
        ArgumentNullException.ThrowIfNull(type);
2,801✔
16

17
        return Nullable.GetUnderlyingType(type) ?? type;
2,801✔
18
    }
19

20
    /// <summary>
21
    /// Determines whether the specified <paramref name="type"/> can be null.
22
    /// </summary>
23
    /// <param name="type">The type to check.</param>
24
    /// <returns>
25
    ///   <c>true</c> if the specified <paramref name="type"/> can be null; otherwise, <c>false</c>.
26
    /// </returns>
27
    public static bool IsNullable(this Type type)
28
    {
29
        ArgumentNullException.ThrowIfNull(type);
24✔
30

31
        if (!type.IsValueType)
24✔
32
            return true;
1✔
33

34
        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
23✔
35
    }
36

37
    /// <summary>
38
    /// Gets the default value the specified <paramref name="type"/>.
39
    /// </summary>
40
    /// <param name="type">The type to get a default value for.</param>
41
    /// <returns>A default value the specified <paramref name="type"/>.</returns>
42
    public static object? Default(this Type type)
43
    {
UNCOV
44
        ArgumentNullException.ThrowIfNull(type);
×
45

46
        return type.IsValueType
×
47
          ? Activator.CreateInstance(type)
×
UNCOV
48
          : null;
×
49
    }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc