< Summary

Information
Class: NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyInfo
Assembly: NexusLabs.Needlr.Injection
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Injection/AssemblyOrdering/AssemblyInfo.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 53
Line coverage: 100%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
get_Location()100%11100%
FromAssembly(...)50%22100%
FromStrings(...)100%11100%
.ctor(...)50%44100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Injection/AssemblyOrdering/AssemblyInfo.cs

#LineLine coverage
 1using System.Reflection;
 2
 3namespace NexusLabs.Needlr.Injection.AssemblyOrdering;
 4
 5/// <summary>
 6/// Provides a simplified view of assembly information for ordering expressions.
 7/// This abstraction works for both reflection (runtime Assembly) and source-gen (compile-time info).
 8/// </summary>
 9public sealed class AssemblyInfo
 10{
 11    /// <summary>
 12    /// The assembly name (without extension).
 13    /// </summary>
 37214    public string Name { get; }
 15
 16    /// <summary>
 17    /// The full file path/location of the assembly (if available).
 18    /// </summary>
 2719    public string Location { get; }
 20
 21    /// <summary>
 22    /// Creates an AssemblyInfo from a runtime Assembly.
 23    /// </summary>
 24    /// <remarks>
 25    /// Note: In single-file published apps, Assembly.Location returns an empty string.
 26    /// This is expected behavior and the Location property will be empty in those scenarios.
 27    /// </remarks>
 28    public static AssemblyInfo FromAssembly(Assembly assembly)
 29    {
 15330        ArgumentNullException.ThrowIfNull(assembly);
 31        // Note: Assembly.Location returns empty string in single-file apps.
 32        // This is documented behavior and acceptable - Location is optional.
 33#pragma warning disable IL3000 // 'Assembly.Location' always returns empty string for single-file apps
 15334        return new AssemblyInfo(
 15335            assembly.GetName().Name ?? string.Empty,
 15336            assembly.Location);
 37#pragma warning restore IL3000
 38    }
 39
 40    /// <summary>
 41    /// Creates an AssemblyInfo from string values (for source-gen scenarios).
 42    /// </summary>
 43    public static AssemblyInfo FromStrings(string name, string location = "")
 44    {
 2945        return new AssemblyInfo(name, location);
 46    }
 47
 18248    private AssemblyInfo(string name, string location)
 49    {
 18250        Name = name ?? string.Empty;
 18251        Location = location ?? string.Empty;
 18252    }
 53}