< Summary

Information
Class: Elsa.Workflows.ActivityExecutionContextExtensions
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.InputOutput.cs
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetInputs(...)100%11100%
GetOutputs(...)100%88100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.InputOutput.cs

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Workflows.Models;
 3
 4namespace Elsa.Workflows;
 5
 6public static class ActivityExecutionContextExtensions
 7{
 8    extension(ActivityExecutionContext context)
 9    {
 10        public IDictionary<string, object> GetInputs()
 11        {
 313012            return context.ActivityState!;
 13        }
 14
 15        public IDictionary<string, object> GetOutputs()
 16        {
 313017            var activity = context.Activity;
 313018            var expressionExecutionContext = context.ExpressionExecutionContext;
 313019            var activityDescriptor = context.ActivityDescriptor;
 313020            var outputDescriptors = activityDescriptor.Outputs;
 21
 565122            var outputs = outputDescriptors.ToDictionary(x => x.Name, x =>
 313023            {
 252124                if (x.IsSerializable == false)
 70325                    return "(not serializable)";
 313026
 181827                var cachedValue = activity.GetOutput(expressionExecutionContext, x.Name);
 313028
 181829                if (cachedValue != null)
 92630                    return cachedValue;
 313031
 89232                if (x.ValueGetter(activity) is Output output && context.TryGet(output.MemoryBlockReference(), out var ou
 12033                    return outputValue!;
 313034
 77235                return null!;
 313036            });
 37
 313038            return outputs;
 39        }
 40    }
 41}