< Summary

Information
Class: Elsa.Workflows.Activities.WriteLine
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/WriteLine.cs
Line coverage
83%
Covered lines: 15
Uncovered lines: 3
Coverable lines: 18
Total lines: 66
Line coverage: 83.3%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
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%
.ctor(...)100%210%
.ctor(...)100%11100%
.ctor(...)100%210%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Text()100%11100%
Execute(...)50%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/WriteLine.cs

#LineLine coverage
 1using System.ComponentModel;
 2using System.Runtime.CompilerServices;
 3using System.Text.Json.Serialization;
 4using Elsa.Expressions.Models;
 5using Elsa.Workflows.Attributes;
 6using Elsa.Workflows.Memory;
 7using Elsa.Workflows.Models;
 8
 9namespace Elsa.Workflows.Activities;
 10
 11/// <summary>
 12///  Write a line of text to the console.
 13/// </summary>
 14[Activity("Elsa", "Console", "Write a line of text to the console.")]
 15public class WriteLine : CodeActivity
 16{
 17    /// <inheritdoc />
 18    [JsonConstructor]
 186519    private WriteLine(string? source = null, int? line = null) : base(source, line)
 20    {
 186521    }
 22
 23    /// <inheritdoc />
 111824    public WriteLine(string text, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : this(ne
 25    {
 111826    }
 27
 28    /// <inheritdoc />
 29    public WriteLine(Func<string> text, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null)
 030        : this(Expression.DelegateExpression(text), source, line)
 31    {
 032    }
 33
 34    /// <inheritdoc />
 35    public WriteLine(Func<ExpressionExecutionContext, string?> text, [CallerFilePath] string? source = null, [CallerLine
 20036        : this(Expression.DelegateExpression(text), source, line)
 37    {
 20038    }
 39
 40    /// <inheritdoc />
 041    public WriteLine(Variable<string> variable, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = n
 42
 43    /// <inheritdoc />
 223644    public WriteLine(Literal<string> literal, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = nul
 45
 46    /// <inheritdoc />
 40047    public WriteLine(Expression expression, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null)
 48
 49    /// <inheritdoc />
 250    public WriteLine(Input<string> text, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : 
 51
 52    /// <summary>
 53    /// The text to write.
 54    /// </summary>
 55    [Description("The text to write.")]
 662856    public Input<string> Text { get; set; } = null!;
 57
 58    /// <inheritdoc />
 59    protected override void Execute(ActivityExecutionContext context)
 60    {
 55861        var text = context.Get(Text);
 55862        var provider = context.GetService<IStandardOutStreamProvider>() ?? new StandardOutStreamProvider(System.Console.
 55863        var textWriter = provider.GetTextWriter();
 55864        textWriter.WriteLine(text);
 55865    }
 66}