< Summary

Information
Class: Elsa.Expressions.Models.ObjectLiteral<T>
Assembly: Elsa.Expressions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/Models/ObjectLiteral.cs
Line coverage
50%
Covered lines: 2
Uncovered lines: 2
Coverable lines: 4
Total lines: 48
Line coverage: 50%
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%210%
.ctor(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/Models/ObjectLiteral.cs

#LineLine coverage
 1using System.Text.Json;
 2using System.Text.Json.Serialization;
 3
 4namespace Elsa.Expressions.Models;
 5
 6/// <summary>
 7/// Represents a literal JSON expression.
 8/// </summary>
 9public class ObjectLiteral : MemoryBlockReference
 10{
 11    /// <inheritdoc />
 12    [JsonConstructor]
 13    public ObjectLiteral()
 14    {
 15    }
 16
 17    /// <inheritdoc />
 18    public ObjectLiteral(string? value)
 19    {
 20        Value = value;
 21    }
 22
 23    /// <summary>
 24    /// The literal JSON string value.
 25    /// </summary>
 26    public string? Value { get; }
 27
 28    /// <summary>
 29    /// Serializes the value into a JSON string in the form of a <see cref="ObjectLiteral{T}"/>
 30    /// </summary>
 31    public static ObjectLiteral From<T>(T value) => new ObjectLiteral<T>(value);
 32}
 33
 34/// <summary>
 35/// Represents a JSON string for the specified type <code>T</code>
 36/// </summary>
 37public class ObjectLiteral<T> : ObjectLiteral
 38{
 39    /// <inheritdoc />
 040    public ObjectLiteral()
 41    {
 042    }
 43
 44    /// <inheritdoc />
 33345    public ObjectLiteral(T value) : base(JsonSerializer.Serialize(value!))
 46    {
 33347    }
 48}

Methods/Properties

.ctor()
.ctor(T)