< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.DiscoveredType
Assembly: NexusLabs.Needlr.Generators
File(s): /actions-runner/_work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/DiscoveredType.cs
Line coverage
95%
Covered lines: 23
Uncovered lines: 1
Coverable lines: 24
Total lines: 62
Line coverage: 95.8%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%22100%
get_TypeName()100%11100%
get_InterfaceNames()100%11100%
get_InterfaceInfos()100%11100%
get_AssemblyName()100%11100%
get_Lifetime()100%11100%
get_ConstructorParameters()100%11100%
get_ServiceKeys()100%11100%
get_SourceFilePath()100%11100%
get_SourceLine()100%11100%
get_IsDisposable()100%11100%
get_ConstructorParameterTypes()100%11100%
get_HasKeyedParameters()100%210%
get_IsKeyed()100%11100%

File(s)

/actions-runner/_work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/DiscoveredType.cs

#LineLine coverage
 1using System;
 2using System.Linq;
 3
 4namespace NexusLabs.Needlr.Generators.Models;
 5
 6/// <summary>
 7/// Information about a discovered injectable type.
 8/// </summary>
 9internal readonly struct DiscoveredType
 10{
 11    public DiscoveredType(string typeName, string[] interfaceNames, string assemblyName, GeneratorLifetime lifetime, Typ
 12    {
 24707513        TypeName = typeName;
 24707514        InterfaceNames = interfaceNames;
 24707515        AssemblyName = assemblyName;
 24707516        Lifetime = lifetime;
 24707517        ConstructorParameters = constructorParameters;
 24707518        ServiceKeys = serviceKeys;
 24707519        SourceFilePath = sourceFilePath;
 24707520        SourceLine = sourceLine;
 24707521        IsDisposable = isDisposable;
 24707522        InterfaceInfos = interfaceInfos ?? Array.Empty<InterfaceInfo>();
 24707523    }
 24
 1156683625    public string TypeName { get; }
 1039842426    public string[] InterfaceNames { get; }
 27    /// <summary>
 28    /// Detailed interface information including source locations.
 29    /// </summary>
 25312230    public InterfaceInfo[] InterfaceInfos { get; }
 50913631    public string AssemblyName { get; }
 120181232    public GeneratorLifetime Lifetime { get; }
 101933033    public TypeDiscoveryHelper.ConstructorParameterInfo[] ConstructorParameters { get; }
 34    /// <summary>
 35    /// Service keys from [Keyed] attributes on this type.
 36    /// </summary>
 60623337    public string[] ServiceKeys { get; }
 31070838    public string? SourceFilePath { get; }
 39    /// <summary>
 40    /// The 1-based line number where this type is declared.
 41    /// </summary>
 24703442    public int SourceLine { get; }
 43    /// <summary>
 44    /// True if this type implements IDisposable or IAsyncDisposable.
 45    /// </summary>
 305846    public bool IsDisposable { get; }
 47
 48    /// <summary>
 49    /// Gets the constructor parameter types (for backward compatibility with existing code paths).
 50    /// </summary>
 28959751    public string[] ConstructorParameterTypes => ConstructorParameters.Select(p => p.TypeName).ToArray();
 52
 53    /// <summary>
 54    /// True if any constructor parameters are keyed services.
 55    /// </summary>
 056    public bool HasKeyedParameters => ConstructorParameters.Any(p => p.IsKeyed);
 57
 58    /// <summary>
 59    /// True if this type has [Keyed] attributes for keyed registration.
 60    /// </summary>
 4852961    public bool IsKeyed => ServiceKeys.Length > 0;
 62}