internal static EventCapture From(Mock <IEventSender> mockSender, EventDataKind forKind, EventSenderResult result)
        {
            var ec = new EventCapture();

            mockSender.Setup(
                s => s.SendEventDataAsync(forKind, It.IsAny <string>(), It.IsAny <int>())
                ).Callback <EventDataKind, string, int>((kind, data, count) =>
            {
                var parsed = LdValue.Parse(data);
                var events = kind == EventDataKind.DiagnosticEvent ? new List <LdValue> {
                    parsed
                } :
                parsed.AsList(LdValue.Convert.Json);
                ec.Events.AddRange(events);
                foreach (var e in events)
                {
                    ec.EventsQueue.Add(e);
                }
            }).Returns(Task.FromResult(result));
            return(ec);
        }
 internal static EventCapture From(Mock <IEventSender> mockSender, EventSenderResult result) =>
 From(mockSender, EventDataKind.AnalyticsEvents, result);