< Summary

Information
Class: TeleFlow.Framework.Application.TeleFlowRuntimeValidatorRunner
Assembly: TeleFlow.Framework.Core
File(s): /_/src/TeleFlow.Framework.Core/Application/TeleFlowRuntimeValidatorRunner.cs
Line coverage
61%
Covered lines: 13
Uncovered lines: 8
Coverable lines: 21
Total lines: 49
Line coverage: 61.9%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Validate(...)87.5%12861.9%

File(s)

/_/src/TeleFlow.Framework.Core/Application/TeleFlowRuntimeValidatorRunner.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2
 3namespace TeleFlow.Framework.Application;
 4
 5/// <summary>
 6/// Runs framework runtime validators from application and transport entrypoints before update processing starts.
 7/// This keeps validation centralized while individual validators remain owned by their framework layer.
 8/// </summary>
 9internal static class TeleFlowRuntimeValidatorRunner
 10{
 11    public static void Validate(IServiceProvider services)
 12    {
 13913        ArgumentNullException.ThrowIfNull(services);
 14
 13915        List<Exception>? exceptions = null;
 16
 46617        foreach (var validator in services.GetServices<ITeleFlowRuntimeValidator>())
 18        {
 19            try
 20            {
 9421                validator.Validate(services);
 8822            }
 623            catch (TeleFlowConfigurationException exception)
 24            {
 625                exceptions ??= [];
 626                exceptions.Add(exception);
 627            }
 28        }
 29
 13930        if (exceptions is null)
 31        {
 13332            return;
 33        }
 34
 635        if (exceptions.Count == 1)
 36        {
 637            throw exceptions[0];
 38        }
 39
 040        throw new TeleFlowConfigurationException(
 041            "TeleFlow configuration is invalid." +
 042            Environment.NewLine +
 043            Environment.NewLine +
 044            string.Join(
 045                Environment.NewLine + Environment.NewLine,
 046                exceptions.Select(static exception => exception.Message)),
 047            new AggregateException(exceptions));
 48    }
 49}