< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.OptionsPropertyInfo
Assembly: NexusLabs.Needlr.Generators
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/Options/OptionsPropertyInfo.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 67
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%22100%
get_Name()100%11100%
get_TypeName()100%11100%
get_IsNullable()100%11100%
get_HasInitOnlySetter()100%11100%
get_IsEnum()100%11100%
get_EnumTypeName()100%11100%
get_ComplexTypeKind()100%11100%
get_ElementTypeName()100%11100%
get_NestedProperties()100%11100%
get_DataAnnotations()100%11100%
get_HasDataAnnotations()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/Options/OptionsPropertyInfo.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4namespace NexusLabs.Needlr.Generators.Models;
 5
 6/// <summary>
 7/// Information about a bindable property on an options class (for AOT code generation).
 8/// </summary>
 9internal readonly struct OptionsPropertyInfo
 10{
 11    public OptionsPropertyInfo(
 12        string name,
 13        string typeName,
 14        bool isNullable,
 15        bool hasInitOnlySetter,
 16        bool isEnum = false,
 17        string? enumTypeName = null,
 18        ComplexTypeKind complexTypeKind = ComplexTypeKind.None,
 19        string? elementTypeName = null,
 20        IReadOnlyList<OptionsPropertyInfo>? nestedProperties = null,
 21        IReadOnlyList<DataAnnotationInfo>? dataAnnotations = null)
 22    {
 27923        Name = name;
 27924        TypeName = typeName;
 27925        IsNullable = isNullable;
 27926        HasInitOnlySetter = hasInitOnlySetter;
 27927        IsEnum = isEnum;
 27928        EnumTypeName = enumTypeName;
 27929        ComplexTypeKind = complexTypeKind;
 27930        ElementTypeName = elementTypeName;
 27931        NestedProperties = nestedProperties;
 27932        DataAnnotations = dataAnnotations ?? Array.Empty<DataAnnotationInfo>();
 27933    }
 34
 35    /// <summary>Property name.</summary>
 34136    public string Name { get; }
 37
 38    /// <summary>Fully qualified type name.</summary>
 14739    public string TypeName { get; }
 40
 41    /// <summary>True if the property type is nullable.</summary>
 2042    public bool IsNullable { get; }
 43
 44    /// <summary>True if the property has an init-only setter.</summary>
 12745    public bool HasInitOnlySetter { get; }
 46
 47    /// <summary>True if the property type is an enum.</summary>
 12948    public bool IsEnum { get; }
 49
 50    /// <summary>The underlying enum type name (for nullable enums, this is the non-nullable type).</summary>
 2451    public string? EnumTypeName { get; }
 52
 53    /// <summary>The kind of complex type (nested object, array, list, dictionary).</summary>
 16854    public ComplexTypeKind ComplexTypeKind { get; }
 55
 56    /// <summary>For collections, the element type. For dictionaries, the value type.</summary>
 1457    public string? ElementTypeName { get; }
 58
 59    /// <summary>For nested objects and collection element types, the bindable properties.</summary>
 3660    public IReadOnlyList<OptionsPropertyInfo>? NestedProperties { get; }
 61
 62    /// <summary>DataAnnotation validation attributes on this property.</summary>
 68563    public IReadOnlyList<DataAnnotationInfo> DataAnnotations { get; }
 64
 65    /// <summary>True if this property has any DataAnnotation validation attributes.</summary>
 66366    public bool HasDataAnnotations => DataAnnotations.Count > 0;
 67}