< 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    {
 45423        Name = name;
 45424        TypeName = typeName;
 45425        IsNullable = isNullable;
 45426        HasInitOnlySetter = hasInitOnlySetter;
 45427        IsEnum = isEnum;
 45428        EnumTypeName = enumTypeName;
 45429        ComplexTypeKind = complexTypeKind;
 45430        ElementTypeName = elementTypeName;
 45431        NestedProperties = nestedProperties;
 45432        DataAnnotations = dataAnnotations ?? Array.Empty<DataAnnotationInfo>();
 45433    }
 34
 35    /// <summary>Property name.</summary>
 136036    public string Name { get; }
 37
 38    /// <summary>Fully qualified type name.</summary>
 63139    public string TypeName { get; }
 40
 41    /// <summary>True if the property type is nullable.</summary>
 14442    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>
 27248    public bool IsEnum { get; }
 49
 50    /// <summary>The underlying enum type name (for nullable enums, this is the non-nullable type).</summary>
 6651    public string? EnumTypeName { get; }
 52
 53    /// <summary>The kind of complex type (nested object, array, list, dictionary).</summary>
 31954    public ComplexTypeKind ComplexTypeKind { get; }
 55
 56    /// <summary>For collections, the element type. For dictionaries, the value type.</summary>
 8757    public string? ElementTypeName { get; }
 58
 59    /// <summary>For nested objects and collection element types, the bindable properties.</summary>
 10460    public IReadOnlyList<OptionsPropertyInfo>? NestedProperties { get; }
 61
 62    /// <summary>DataAnnotation validation attributes on this property.</summary>
 84563    public IReadOnlyList<DataAnnotationInfo> DataAnnotations { get; }
 64
 65    /// <summary>True if this property has any DataAnnotation validation attributes.</summary>
 82366    public bool HasDataAnnotations => DataAnnotations.Count > 0;
 67}