< Summary

Information
Class: Elsa.Server.Web.ActivityHosts.Penguin
Assembly: Elsa.Server.Web
File(s): /home/runner/work/elsa-core/elsa-core/src/apps/Elsa.Server.Web/ActivityHosts/Penguin.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 50
Line coverage: 0%
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%
Wag()100%210%
Jump()100%210%
Swim()100%210%
Eat(...)100%210%
Sleep(...)100%210%
Wake(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/apps/Elsa.Server.Web/ActivityHosts/Penguin.cs

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Workflows;
 3using Elsa.Workflows.Attributes;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Server.Web.ActivityHosts;
 7
 8/// <summary>
 9/// A sample activity host that represents a penguin.
 10/// Each of its public methods is an activity that can be executed.
 11/// Method arguments are interpreted as input values, except for ActivityExecutionContext and CancellationToken.
 12/// </summary>
 13/// <param name="logger"></param>
 14[UsedImplicitly]
 015public class Penguin(ILogger<Penguin> logger)
 16{
 17    [Activity(Description = "Wag the penguin")]
 18    public void Wag()
 19    {
 020        logger.LogInformation("The penguin is wagging!");
 021    }
 22
 23    public void Jump()
 24    {
 025        logger.LogInformation("The penguin is jumping!");
 026    }
 27
 28    public void Swim()
 29    {
 030        logger.LogInformation("The penguin is swimming!");
 031    }
 32
 33    public void Eat(string food)
 34    {
 035        logger.LogInformation($"The penguin is eating {food}!");
 036    }
 37
 38    public string Sleep(ActivityExecutionContext context)
 39    {
 040        logger.LogInformation("The penguin is sleeping!");
 041        var bookmark = context.CreateBookmark(Wake);
 042        return context.GenerateBookmarkTriggerToken(bookmark.Id);
 43    }
 44
 45    private ValueTask Wake(ActivityExecutionContext context)
 46    {
 047        logger.LogInformation("The penguin woke up!");
 048        return ValueTask.CompletedTask;
 49    }
 50}