< Summary

Information
Class: Elsa.Expressions.Models.Literal
Assembly: Elsa.Expressions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/Models/Literal.cs
Line coverage
85%
Covered lines: 6
Uncovered lines: 1
Coverable lines: 7
Total lines: 48
Line coverage: 85.7%
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%
.ctor(...)100%11100%
get_Value()100%11100%
From(...)100%210%

File(s)

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

#LineLine coverage
 1namespace Elsa.Expressions.Models;
 2
 3/// <summary>
 4/// A literal expression that represents a constant value.
 5/// </summary>
 6public class Literal : MemoryBlockReference
 7{
 8    /// <inheritdoc />
 16869    public Literal()
 10    {
 168611    }
 12
 13    /// <inheritdoc />
 310514    public Literal(object? value, string? id = null) : base(id!)
 15    {
 310516        Value = value;
 310517    }
 18
 19    /// <summary>
 20    /// Gets the value of the literal.
 21    /// </summary>
 310522    public object? Value { get; }
 23
 24    /// <summary>
 25    /// Creates a literal expression from a value.
 26    /// </summary>
 27    /// <param name="value">The value.</param>
 28    /// <typeparam name="T">The value type.</typeparam>
 29    /// <returns>A literal expression.</returns>
 030    public static Literal From<T>(T value) => new Literal<T>(value);
 31}
 32
 33/// <summary>
 34/// A literal expression that represents a constant value.
 35/// </summary>
 36/// <typeparam name="T">The value type.</typeparam>
 37public class Literal<T> : Literal
 38{
 39    /// <inheritdoc />
 40    public Literal()
 41    {
 42    }
 43
 44    /// <inheritdoc />
 45    public Literal(T value, string? id = null) : base(value!, id)
 46    {
 47    }
 48}