< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.DiscoveredFactory
Assembly: NexusLabs.Needlr.Generators
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/DiscoveredFactory.cs
Line coverage
85%
Covered lines: 17
Uncovered lines: 3
Coverable lines: 20
Total lines: 54
Line coverage: 85%
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%210%
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)

/home/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    {
 2417        TypeName = typeName;
 2418        InterfaceNames = interfaceNames;
 2419        AssemblyName = assemblyName;
 2420        GenerationMode = generationMode;
 2421        Constructors = constructors;
 2422        ReturnTypeOverride = returnTypeName;
 2423        SourceFilePath = sourceFilePath;
 2424    }
 25
 35026    public string TypeName { get; }
 027    public string[] InterfaceNames { get; }
 028    public string AssemblyName { get; }
 29    /// <summary>Mode flags: 1=Func, 2=Interface, 3=All</summary>
 7230    public int GenerationMode { get; }
 9231    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>
 7836    public string? ReturnTypeOverride { get; }
 037    public string? SourceFilePath { get; }
 38
 2439    public bool GenerateFunc => (GenerationMode & 1) != 0;
 4840    public bool GenerateInterface => (GenerationMode & 2) != 0;
 41
 42    /// <summary>Gets the type that factory Create() and Func should return.</summary>
 7843    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        {
 16850            var parts = TypeName.Split('.');
 16851            return parts[parts.Length - 1];
 52        }
 53    }
 54}