< Summary

Information
Class: Elsa.Workflows.Activities.ReadLine
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/ReadLine.cs
Line coverage
63%
Covered lines: 7
Uncovered lines: 4
Coverable lines: 11
Total lines: 37
Line coverage: 63.6%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
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%210%
.ctor(...)100%210%
Execute(...)100%22100%

File(s)

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

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Expressions.Models;
 3using Elsa.Workflows.Attributes;
 4using Elsa.Workflows.Models;
 5
 6namespace Elsa.Workflows.Activities;
 7
 8/// <summary>
 9/// Read a line of text from the console.
 10/// </summary>
 11[Activity("Elsa", "Console", "Read a line of text from the console.")]
 12public class ReadLine : CodeActivity<string>
 13{
 14    /// <inheritdoc />
 815    public ReadLine([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 16    {
 817    }
 18
 19    /// <inheritdoc />
 020    public ReadLine(MemoryBlockReference output, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = 
 21    {
 022    }
 23
 24    /// <inheritdoc />
 025    public ReadLine(Output<string>? output, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null)
 26    {
 027    }
 28
 29    /// <inheritdoc />
 30    protected override void Execute(ActivityExecutionContext context)
 31    {
 832        var provider = context.GetService<IStandardInStreamProvider>() ?? new StandardInStreamProvider(Console.In);
 833        var reader = provider.GetTextReader();
 834        var text = reader.ReadLine()!;
 835        context.Set(Result, text);
 836    }
 37}