< Summary

Information
Class: Elsa.AI.Host.Services.AIGroundingJson
Assembly: Elsa.AI.Host
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Host/Services/AIGroundingJson.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 20
Line coverage: 100%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
ToJsonObject(...)50%22100%
ToJsonArray(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Host/Services/AIGroundingJson.cs

#LineLine coverage
 1using System.Text.Json;
 2
 3namespace Elsa.AI.Host.Services;
 4
 5internal static class AIGroundingJson
 6{
 27    private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web);
 8
 9    public static JsonObject ToJsonObject<T>(T value) =>
 1410        JsonSerializer.SerializeToNode(value, SerializerOptions) as JsonObject ?? [];
 11
 12    public static JsonArray ToJsonArray<T>(IEnumerable<T> values)
 13    {
 514        var array = new JsonArray();
 1415        foreach (var value in values)
 216            array.Add(JsonSerializer.SerializeToNode(value, SerializerOptions));
 17
 518        return array;
 19    }
 20}