< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Collectors.CollectorServiceCollectionExtensions
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Collectors/CollectorServiceCollectionExtensions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 26
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddAgentOutputCollector(...)100%210%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Collectors/CollectorServiceCollectionExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using Microsoft.Extensions.DependencyInjection.Extensions;
 3
 4namespace NexusLabs.Needlr.AgentFramework.Collectors;
 5
 6/// <summary>
 7/// Extension methods for registering <see cref="IAgentOutputCollectorAccessor{T}"/> in DI.
 8/// </summary>
 9/// <remarks>
 10/// Generic open types cannot be auto-registered by the framework. Call
 11/// <see cref="AddAgentOutputCollector{T}"/> once per record type at startup.
 12/// </remarks>
 13public static class CollectorServiceCollectionExtensions
 14{
 15    /// <summary>
 16    /// Registers <see cref="IAgentOutputCollectorAccessor{T}"/> as a singleton for the given
 17    /// record type <typeparamref name="T"/>.
 18    /// </summary>
 19    /// <typeparam name="T">The record type the collector accumulates.</typeparam>
 20    public static IServiceCollection AddAgentOutputCollector<T>(this IServiceCollection services)
 21    {
 022        ArgumentNullException.ThrowIfNull(services);
 023        services.TryAddSingleton<IAgentOutputCollectorAccessor<T>, AgentOutputCollectorAccessor<T>>();
 024        return services;
 25    }
 26}