< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.DiscoveredFactory
Assembly: NexusLabs.Needlr.Generators
File(s): /actions-runner/_work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/DiscoveredFactory.cs
Line coverage
90%
Covered lines: 18
Uncovered lines: 2
Coverable lines: 20
Total lines: 54
Line coverage: 90%
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%11100%
get_TypeName()100%11100%
get_InterfaceNames()100%11100%
get_AssemblyName()100%210%
get_GenerationMode()100%11100%
get_Constructors()100%11100%
get_ReturnTypeOverride()100%11100%
get_SourceFilePath()100%210%
get_GenerateFunc()100%11100%
get_GenerateInterface()100%11100%
get_ReturnTypeName()100%22100%
get_SimpleTypeName()100%11100%

File(s)

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

#LineLine coverage
 1namespace NexusLabs.Needlr.Generators.Models;
 2
 3/// <summary>
 4/// Information about a factory-generated type (from [GenerateFactory]).
 5/// </summary>
 6internal readonly struct DiscoveredFactory
 7{
 8    public DiscoveredFactory(
 9        string typeName,
 10        string[] interfaceNames,
 11        string assemblyName,
 12        int generationMode,
 13        FactoryDiscoveryHelper.FactoryConstructorInfo[] constructors,
 14        string? returnTypeName = null,
 15        string? sourceFilePath = null)
 16    {
 4317        TypeName = typeName;
 4318        InterfaceNames = interfaceNames;
 4319        AssemblyName = assemblyName;
 4320        GenerationMode = generationMode;
 4321        Constructors = constructors;
 4322        ReturnTypeOverride = returnTypeName;
 4323        SourceFilePath = sourceFilePath;
 4324    }
 25
 45026    public string TypeName { get; }
 627    public string[] InterfaceNames { get; }
 028    public string AssemblyName { get; }
 29    /// <summary>Mode flags: 1=Func, 2=Interface, 3=All</summary>
 8430    public int GenerationMode { get; }
 10831    public FactoryDiscoveryHelper.FactoryConstructorInfo[] Constructors { get; }
 32    /// <summary>
 33    /// If set, the factory Create() and Func return this type instead of the concrete type.
 34    /// Used when [GenerateFactory&lt;T&gt;] is applied.
 35    /// </summary>
 9836    public string? ReturnTypeOverride { get; }
 037    public string? SourceFilePath { get; }
 38
 2839    public bool GenerateFunc => (GenerationMode & 1) != 0;
 5640    public bool GenerateInterface => (GenerationMode & 2) != 0;
 41
 42    /// <summary>Gets the type that factory Create() and Func should return.</summary>
 9843    public string ReturnTypeName => ReturnTypeOverride ?? TypeName;
 44
 45    /// <summary>Gets just the type name without namespace (e.g., "MyService" from "global::TestApp.MyService").</summar
 46    public string SimpleTypeName
 47    {
 48        get
 49        {
 20450            var parts = TypeName.Split('.');
 20451            return parts[parts.Length - 1];
 52        }
 53    }
 54}