< Summary

Information
Class: Elsa.Common.Serialization.Serializers
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Serialization/Serializers.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 25
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DeserializeConfiguration(...)0%620%
DeserializeConfiguration(...)0%620%
SerializeConfiguration(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Serialization/Serializers.cs

#LineLine coverage
 1using System.Text.Json;
 2using Microsoft.Extensions.Configuration;
 3
 4namespace Elsa.Common.Serialization;
 5
 6public static class Serializers
 7{
 8    public static IConfiguration DeserializeConfiguration(JsonElement? json)
 9    {
 010        return DeserializeConfiguration(json?.GetRawText());
 11    }
 12
 13    public static IConfiguration DeserializeConfiguration(string? json)
 14    {
 015        if (json == null)
 016            return new ConfigurationBuilder().Build();
 17
 018        return JsonSerializer.Deserialize<IConfiguration>(json, SerializerOptions.ConfigurationJsonSerializerOptions)!;
 19    }
 20
 21    public static string SerializeConfiguration(IConfiguration configuration)
 22    {
 023        return JsonSerializer.Serialize(configuration, SerializerOptions.ConfigurationJsonSerializerOptions);
 24    }
 25}