< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.DiscoveredType
Assembly: NexusLabs.Needlr.Generators
File(s): /home/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
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_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)

/home/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    {
 23353813        TypeName = typeName;
 23353814        InterfaceNames = interfaceNames;
 23353815        AssemblyName = assemblyName;
 23353816        Lifetime = lifetime;
 23353817        ConstructorParameters = constructorParameters;
 23353818        ServiceKeys = serviceKeys;
 23353819        SourceFilePath = sourceFilePath;
 23353820        SourceLine = sourceLine;
 23353821        IsDisposable = isDisposable;
 23353822        InterfaceInfos = interfaceInfos ?? Array.Empty<InterfaceInfo>();
 23353823    }
 24
 1151682625    public string TypeName { get; }
 1033827326    public string[] InterfaceNames { get; }
 27    /// <summary>
 28    /// Detailed interface information including source locations.
 29    /// </summary>
 23839030    public InterfaceInfo[] InterfaceInfos { get; }
 48217631    public string AssemblyName { get; }
 115441132    public GeneratorLifetime Lifetime { get; }
 97385833    public TypeDiscoveryHelper.ConstructorParameterInfo[] ConstructorParameters { get; }
 34    /// <summary>
 35    /// Service keys from [Keyed] attributes on this type.
 36    /// </summary>
 57796837    public string[] ServiceKeys { get; }
 29658238    public string? SourceFilePath { get; }
 39    /// <summary>
 40    /// The 1-based line number where this type is declared.
 41    /// </summary>
 23354842    public int SourceLine { get; }
 43    /// <summary>
 44    /// True if this type implements IDisposable or IAsyncDisposable.
 45    /// </summary>
 243346    public bool IsDisposable { get; }
 47
 48    /// <summary>
 49    /// Gets the constructor parameter types (for backward compatibility with existing code paths).
 50    /// </summary>
 28935351    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>
 4787061    public bool IsKeyed => ServiceKeys.Length > 0;
 62}