< 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
95%
Covered lines: 19
Uncovered lines: 1
Coverable lines: 20
Total lines: 54
Line coverage: 95%
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%11100%
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    {
 5417        TypeName = typeName;
 5418        InterfaceNames = interfaceNames;
 5419        AssemblyName = assemblyName;
 5420        GenerationMode = generationMode;
 5421        Constructors = constructors;
 5422        ReturnTypeOverride = returnTypeName;
 5423        SourceFilePath = sourceFilePath;
 5424    }
 25
 62026    public string TypeName { get; }
 627    public string[] InterfaceNames { get; }
 128    public string AssemblyName { get; }
 29    /// <summary>Mode flags: 1=Func, 2=Interface, 3=All</summary>
 16130    public int GenerationMode { get; }
 15331    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>
 13836    public string? ReturnTypeOverride { get; }
 037    public string? SourceFilePath { get; }
 38
 7939    public bool GenerateFunc => (GenerationMode & 1) != 0;
 8240    public bool GenerateInterface => (GenerationMode & 2) != 0;
 41
 42    /// <summary>Gets the type that factory Create() and Func should return.</summary>
 13843    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        {
 28550            var parts = TypeName.Split('.');
 28551            return parts[parts.Length - 1];
 52        }
 53    }
 54}