< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Scripting.LanguageRuntimeExtensions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Scripting/LanguageRuntimeExtensions.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
42%
Covered lines: 3
Uncovered lines: 4
Coverable lines: 7
Total lines: 28
Line coverage: 42.8%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseLanguageRuntime(...)0%7442.85%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Scripting/LanguageRuntimeExtensions.cs

#LineLine coverage
 1namespace Kestrun.Scripting;
 2
 3/// <summary>
 4/// Extension methods for <see cref="IApplicationBuilder"/> to support language-based runtime configuration.
 5/// </summary>
 6public static class LanguageRuntimeExtensions
 7{
 8    /// <summary>
 9    /// Configures the application pipeline to use a specific language runtime for endpoints tagged with the given <see 
 10    /// </summary>
 11    /// <param name="app">The application builder to configure.</param>
 12    /// <param name="language">The script language to filter endpoints by.</param>
 13    /// <param name="configure">The configuration action to apply when the language matches.</param>
 14    /// <returns>The configured <see cref="IApplicationBuilder"/> instance.</returns>
 15    public static IApplicationBuilder UseLanguageRuntime(
 16        this IApplicationBuilder app,
 17        ScriptLanguage language,
 18        Action<IApplicationBuilder> configure)
 19    {
 120        return app.UseWhen(context =>
 121        {
 022            var attr =
 023                context.GetEndpoint()?.Metadata
 024                   .GetMetadata<ScriptLanguageAttribute>();
 025            return attr?.Language == language;
 126        }, configure);
 27    }
 28}