< Summary

Information
Class: Elsa.Workflows.Serialization.Converters.VariableConverterFactory
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Serialization/Converters/VariableConverterFactory.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 30
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
CanConvert(...)100%11100%
CreateConverter(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Serialization/Converters/VariableConverterFactory.cs

#LineLine coverage
 1using System.Text.Json;
 2using System.Text.Json.Serialization;
 3using Elsa.Expressions.Contracts;
 4using Elsa.Workflows.Memory;
 5using Microsoft.Extensions.Logging;
 6
 7namespace Elsa.Workflows.Serialization.Converters;
 8
 9/// <summary>
 10/// Produces <see cref="VariableConverter"/> instances for <see cref="Variable"/> and <see cref="Variable{T}"/>.
 11/// </summary>
 12public class VariableConverterFactory : JsonConverterFactory
 13{
 14    private readonly IWellKnownTypeRegistry _wellKnownTypeRegistry;
 15    private readonly ILoggerFactory _loggerFactory;
 16
 17    /// <inheritdoc />
 18    // ReSharper disable once ContextualLoggerProblem
 1223519    public VariableConverterFactory(IWellKnownTypeRegistry wellKnownTypeRegistry, ILoggerFactory loggerFactory)
 20    {
 1223521        _wellKnownTypeRegistry = wellKnownTypeRegistry;
 1223522        _loggerFactory = loggerFactory;
 1223523    }
 24
 25    /// <inheritdoc />
 20486526    public override bool CanConvert(Type typeToConvert) => typeof(Variable).IsAssignableFrom(typeToConvert);
 27
 28    /// <inheritdoc />
 387029    public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) => new VariableConv
 30}