< Summary

Information
Class: Elsa.Extensions.JsonSerializerOptionsExtensions
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Extensions/JsonSerializerOptionsExtensions.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 30
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
WithConverters(...)100%22100%
Clone(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Extensions/JsonSerializerOptionsExtensions.cs

#LineLine coverage
 1using System.Text.Json;
 2using System.Text.Json.Serialization;
 3
 4// ReSharper disable once CheckNamespace
 5namespace Elsa.Extensions;
 6
 7/// <summary>
 8/// Adds extension methods to <see cref="JsonSerializerOptions"/>.
 9/// </summary>
 10public static class JsonSerializerOptionsExtensions
 11{
 12    /// <summary>
 13    /// Adds the specified converters to the options.
 14    /// </summary>
 15    public static JsonSerializerOptions WithConverters(this JsonSerializerOptions options, params JsonConverter[] conver
 16    {
 433817        foreach (var converter in converters)
 162618            options.Converters.Add(converter);
 19
 54320        return options;
 21    }
 22
 23    /// <summary>
 24    /// Clones the options.
 25    /// </summary>
 26    public static JsonSerializerOptions Clone(this JsonSerializerOptions options)
 27    {
 2942128        return new(options);
 29    }
 30}