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

lucaslorentz / durabletask-extensions / 19714733464

26 Nov 2025 07:08PM UTC coverage: 78.714%. Remained the same
19714733464

push

github

web-flow
Merge 7ae27b4d0 into a154947f6

43 of 50 new or added lines in 4 files covered. (86.0%)

35 existing lines in 2 files now uncovered.

2289 of 2908 relevant lines covered (78.71%)

120.08 hits per line

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

87.18
/src/LLL.DurableTask.Core/Serializing/HistoryEventConverter.cs
1
using System;
2
using System.Collections.Generic;
3
using DurableTask.Core.History;
4
using Newtonsoft.Json;
5
using Newtonsoft.Json.Linq;
6

7
namespace LLL.DurableTask.Core.Serializing;
8

9
public class HistoryEventConverter : JsonConverter
10
{
11
    private static readonly Dictionary<EventType, Type> _typesMap = new()
1✔
12
    {
1✔
13
        { EventType.ContinueAsNew, typeof(ContinueAsNewEvent) },
1✔
14
        { EventType.EventRaised, typeof(EventRaisedEvent) },
1✔
15
        { EventType.EventSent, typeof(EventSentEvent) },
1✔
16
        { EventType.ExecutionCompleted, typeof(ExecutionCompletedEvent) },
1✔
17
        //{ EventType.ExecutionFailed, typeof(ExecutionFailedEvent) },
1✔
18
        { EventType.ExecutionStarted, typeof(ExecutionStartedEvent) },
1✔
19
        { EventType.ExecutionTerminated, typeof(ExecutionTerminatedEvent) },
1✔
20
        { EventType.ExecutionRewound, typeof(ExecutionRewoundEvent) },
1✔
21
        { EventType.GenericEvent, typeof(GenericEvent) },
1✔
22
        { EventType.HistoryState, typeof(HistoryStateEvent) },
1✔
23
        { EventType.OrchestratorCompleted, typeof(OrchestratorCompletedEvent) },
1✔
24
        { EventType.OrchestratorStarted, typeof(OrchestratorStartedEvent) },
1✔
25
        { EventType.SubOrchestrationInstanceCompleted, typeof(SubOrchestrationInstanceCompletedEvent) },
1✔
26
        { EventType.SubOrchestrationInstanceCreated, typeof(SubOrchestrationInstanceCreatedEvent) },
1✔
27
        { EventType.SubOrchestrationInstanceFailed, typeof(SubOrchestrationInstanceFailedEvent) },
1✔
28
        { EventType.TaskCompleted, typeof(TaskCompletedEvent) },
1✔
29
        { EventType.TaskFailed, typeof(TaskFailedEvent) },
1✔
30
        { EventType.TaskScheduled, typeof(TaskScheduledEvent) },
1✔
31
        { EventType.TimerCreated, typeof(TimerCreatedEvent) },
1✔
32
        { EventType.TimerFired, typeof(TimerFiredEvent) }
1✔
33
    };
1✔
34

UNCOV
35
    public override bool CanWrite => false;
×
36

37
    public override bool CanConvert(Type objectType)
38
    {
39
        // Avoid recursion by only converting when target type is unknown
40
        return objectType == typeof(HistoryEvent);
28,809✔
41
    }
42

43
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
44
    {
45
        var jObject = JObject.Load(reader);
703✔
46

47
        var eventType = jObject.GetValue("EventType", StringComparison.OrdinalIgnoreCase)
703✔
48
            ?.ToObject<EventType>()
703✔
49
            ?? throw new Exception("Expected EventType field in HistoryEvent");
703✔
50

51
        var eventId = jObject.GetValue("EventId", StringComparison.OrdinalIgnoreCase)
703✔
52
            ?.ToObject<int>()
703✔
53
            ?? throw new Exception("Expected EventId field in HistoryEvent");
703✔
54

55
        var type = _typesMap[eventType];
703✔
56

57
        if (type == typeof(ExecutionRewoundEvent))
703✔
58
        {
59
            // Handles multiple constructors present in ExecutionRewoundEvent
NEW
60
            var @event = new ExecutionRewoundEvent(eventId);
×
NEW
61
            serializer.Populate(jObject.CreateReader(), @event);
×
NEW
62
            return @event;
×
63
        }
64

65
        return jObject.ToObject(type, serializer);
703✔
66
    }
67

68
    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
69
    {
70
        throw new NotImplementedException();
×
71
    }
72
}
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

© 2026 Coveralls, Inc