• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lucaslorentz / durabletask-extensions / 5835653629

pending completion
5835653629

push

github

lucaslorentz
Add ExtendedOrchestrationContext to simplify workers API

71 of 71 new or added lines in 5 files covered. (100.0%)

2303 of 2798 relevant lines covered (82.31%)

145.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/LLL.DurableTask.Worker/ExtendedOrchestrationContext.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Threading;
4
using System.Threading.Tasks;
5
using DurableTask.Core;
6
using DurableTask.Core.Serializing;
7
using LLL.DurableTask.Worker.Utils;
8

9
namespace LLL.DurableTask.Worker
10
{
11
    public class ExtendedOrchestrationContext
12
    {
13
        private static readonly Guid _orchestrationGuidNamespace = new("93810b2d-3411-4fc0-b51b-47f2233dac7a");
1✔
14
        private int _count = 0;
15

16
        private readonly OrchestrationContext _baseContext;
17

18
        public ExtendedOrchestrationContext(OrchestrationContext baseContext)
26✔
19
        {
20
            _baseContext = baseContext;
26✔
21
        }
22

23
        public OrchestrationContext BaseContext => _baseContext;
27✔
24

25
        /// <inheritdoc cref="OrchestrationContext.ContinueAsNew" />
26
        public void ContinueAsNew(object input)
27
        {
28
            BaseContext.ContinueAsNew(input);
×
29
        }
30

31
        /// <inheritdoc cref="OrchestrationContext.ContinueAsNew" />
32
        public void ContinueAsNew(string newVersion, object input)
33
        {
34
            BaseContext.ContinueAsNew(newVersion, input);
×
35
        }
36

37
        /// <inheritdoc cref="OrchestrationContext.CreateSubOrchestrationInstance" />
38
        public Task<T> CreateSubOrchestrationInstance<T>(string name, string version, object input)
39
        {
40
            return BaseContext.CreateSubOrchestrationInstance<T>(name, version, input);
×
41
        }
42

43
        /// <inheritdoc cref="OrchestrationContext.CreateSubOrchestrationInstance" />
44
        public Task<T> CreateSubOrchestrationInstance<T>(string name, string version, string instanceId, object input)
45
        {
46
            return BaseContext.CreateSubOrchestrationInstance<T>(name, version, instanceId, input);
×
47
        }
48

49
        /// <inheritdoc cref="OrchestrationContext.CreateSubOrchestrationInstance" />
50
        public Task<T> CreateSubOrchestrationInstance<T>(string name, string version, string instanceId, object input, IDictionary<string, string> tags)
51
        {
52
            return BaseContext.CreateSubOrchestrationInstance<T>(name, version, instanceId, input, tags);
×
53
        }
54

55
        /// <inheritdoc cref="OrchestrationContext.CreateTimer" />
56
        public Task<T> CreateTimer<T>(DateTime fireAt, T state)
57
        {
58
            return BaseContext.CreateTimer(fireAt, state); ;
3✔
59
        }
60

61
        /// <inheritdoc cref="OrchestrationContext.CreateTimer" />
62
        public Task<T> CreateTimer<T>(DateTime fireAt, T state, CancellationToken cancelToken)
63
        {
64
            return BaseContext.CreateTimer(fireAt, state, cancelToken);
2✔
65
        }
66

67
        /// <inheritdoc cref="OrchestrationContext.ScheduleTask" />
68
        public Task<TResult> ScheduleTask<TResult>(string name, string version, params object[] parameters)
69
        {
70
            return BaseContext.ScheduleTask<TResult>(name, version, parameters);
13✔
71
        }
72

73
        /// <inheritdoc cref="OrchestrationContext.SendEvent" />
74
        public void SendEvent(OrchestrationInstance orchestrationInstance, string eventName, object eventData)
75
        {
76
            BaseContext.SendEvent(orchestrationInstance, eventName, eventData);
×
77
        }
78

79
        /// <inheritdoc cref="OrchestrationContext.CurrentUtcDateTime" />
80
        public virtual DateTime CurrentUtcDateTime => BaseContext.CurrentUtcDateTime;
5✔
81

82
        /// <inheritdoc cref="OrchestrationContext.IsReplaying" />
83
        public bool IsReplaying => BaseContext.IsReplaying;
×
84

85
        /// <inheritdoc cref="OrchestrationContext.MessageDataConverter" />
86
        public JsonDataConverter MessageDataConverter => _baseContext.MessageDataConverter;
53✔
87

88
        /// <inheritdoc cref="OrchestrationContext.ErrorDataConverter" />
89
        public JsonDataConverter ErrorDataConverter => _baseContext.ErrorDataConverter;
×
90

91
        /// <inheritdoc cref="OrchestrationContext.OrchestrationInstance" />
92
        public OrchestrationInstance OrchestrationInstance => _baseContext.OrchestrationInstance;
×
93

94
        public event Action<string, string> Event;
95
        public Func<string> StatusProvider { get; set; }
46✔
96

97
        public Guid NewGuid()
98
        {
99
            return DeterministicGuid.Create(_orchestrationGuidNamespace, $"{BaseContext.OrchestrationInstance.ExecutionId}/{++_count}");
4✔
100
        }
101

102
        internal void RaiseEvent(string name, string input)
103
        {
104
            Event?.Invoke(name, input);
14✔
105
        }
106
    }
107
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc