< 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
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)

/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    {
 26585013        TypeName = typeName;
 26585014        InterfaceNames = interfaceNames;
 26585015        AssemblyName = assemblyName;
 26585016        Lifetime = lifetime;
 26585017        ConstructorParameters = constructorParameters;
 26585018        ServiceKeys = serviceKeys;
 26585019        SourceFilePath = sourceFilePath;
 26585020        SourceLine = sourceLine;
 26585021        IsDisposable = isDisposable;
 26585022        InterfaceInfos = interfaceInfos ?? Array.Empty<InterfaceInfo>();
 26585023    }
 24
 1362372525    public string TypeName { get; }
 1228291426    public string[] InterfaceNames { get; }
 27    /// <summary>
 28    /// Detailed interface information including source locations.
 29    /// </summary>
 28887730    public InterfaceInfo[] InterfaceInfos { get; }
 54668631    public string AssemblyName { get; }
 137476332    public GeneratorLifetime Lifetime { get; }
 112684033    public TypeDiscoveryHelper.ConstructorParameterInfo[] ConstructorParameters { get; }
 34    /// <summary>
 35    /// Service keys from [Keyed] attributes on this type.
 36    /// </summary>
 67774337    public string[] ServiceKeys { get; }
 34649738    public string? SourceFilePath { get; }
 39    /// <summary>
 40    /// The 1-based line number where this type is declared.
 41    /// </summary>
 26584342    public int SourceLine { get; }
 43    /// <summary>
 44    /// True if this type implements IDisposable or IAsyncDisposable.
 45    /// </summary>
 1154846    public bool IsDisposable { get; }
 47
 48    /// <summary>
 49    /// Gets the constructor parameter types (for backward compatibility with existing code paths).
 50    /// </summary>
 34373951    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>
 6550961    public bool IsKeyed => ServiceKeys.Length > 0;
 62}