Example #1
0
 private void AddEventsInOrder(params Event[] events)
 {
     foreach (var @event in events)
     {
         _sut.Add(@event);
     }
 }
Example #2
0
        public void IfNumberOfStoredEventsExceedsCapacity_EarlierEventsAreRemoved()
        {
            var sut = new EventHistory(1);

            sut.Add(new Event("_", id: "1"));
            sut.Add(new Event("_", id: "2"));

            var moreRecentEvents = sut.GetSubsequentEvents("1");

            moreRecentEvents.Should().BeEmpty("no event with id 1 can be found");
        }
Example #3
0
        public void IfNumberOfStoredEventsExceedsCapacity_OtherEventsCanStillBeRetrieved()
        {
            var sut = new EventHistory(2);

            sut.Add(new Event("_", id: "1"));
            sut.Add(new Event("_", id: "2"));
            sut.Add(new Event("_", id: "3"));

            var moreRecentEvents = sut.GetSubsequentEvents("2");

            moreRecentEvents.Should().ContainSingle(e => e.Id == "3");
        }
Example #4
0
 /// <summary>
 /// :&gt; ENHANCE JohnT: we should have individual methods and default formats
 ///             :&gt; for more of the basic types.
 ///             :&gt; String alternations.
 ///              Add a single, isolated alternative (of the indicated property of the open object).
 /// </summary>
 public void AddStringAltMember(int tag, int ws, IVwViewConstructor vc)
 {
     EventHistory.Add(new StringAltMemberAdded()
     {
         Hvo = OpenObject, Tag = tag, Ws = ws, Vc = vc
     });
 }
Example #5
0
 /// <summary>
 /// :&gt; Inserting basic object property displays into the view.
 ///              The view looks up the value of the indicated property on the current open
 ///              object and displays it. The property must be a (non alternation) string property.
 /// </summary>
 public void AddStringProp(int tag, IVwViewConstructor vc)
 {
     EventHistory.Add(new StringPropAdded()
     {
         Hvo = OpenObject, Tag = tag, Vc = vc
     });
 }
        protected override async Task Handle(SendNotificationEventsToSubscriberCommand request, CancellationToken cancellationToken)
        {
            _logger.LogInformation("{EventCount} event(s) received on topic '{TopicName}'", request.Events.Length, request.Topic.Name);

            foreach (var eventGridEvent in request.Events)
            {
                eventGridEvent.Topic           = $"/subscriptions/{Guid.Empty:D}/resourceGroups/eventGridSimulator/providers/Microsoft.EventGrid/topics/{request.Topic.Name}";
                eventGridEvent.MetadataVersion = "1";
            }

            var sentEvents = await Task.WhenAll(request.Events.Select(async evt => new EventHistory.EventHistoryRecord
            {
                Event            = evt,
                ExecutionResults = await Task.WhenAll(request.Topic.Subscribers.Select(async subscription =>
                {
                    var(response, exception) = await SendToSubscriber(subscription, evt);
                    return(new EventHistory.EventExecutionResult
                    {
                        Subscription = subscription.Name,
                        ResponseStatusCode = (int?)response?.StatusCode,
                        ResponseReasonPhrase = response?.ReasonPhrase,
                        ResponseBody = response?.Content != null ? await response.Content.ReadAsStringAsync() : null,
                        Exception = exception?.ToString()
                    });
                }))
            }));

            _eventStore.Add(request.Topic, sentEvents);
        }
Example #7
0
 /// <summary>
 /// Add literal text that is not a property and not editable.
 /// </summary>
 /// <param name="_ss"/>
 public void AddString(ITsString _ss)
 {
     EventHistory.Add(new StringAdded {
         Content = _ss
     });
 }
 public void OnWristbandWriteComplete()
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandWriteComplete", false));
 }
 public void OnWristbandStepsCollected(StepsData stepsData)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandStepsCollected > " + stepsData.totalStepsWalked().ToString(), false));
 }
 public void OnWristbandUnknownProfile(string pheriperalID, string pheriperalName)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandUnknownProfile > name: " + pheriperalName + ", id: " + pheriperalID, false));
 }
 public void OnWristbandConnected(string pheriperalID, string pheriperalName, WristbandProfile profile)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandConnected > name:" + pheriperalName + ", id:" + pheriperalID + ", profile: " + profile.description.ToString(), false));
 }
 public void OnWristbandDebugMessage(string msg)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandDebugMessage > " + msg, false));
 }
 public void OnError(WristbandProtocolError error, string info)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnError > " + info, true));
 }
 public void OnBluetoothDeInitialized()
 {
     EventHistory.Add(new WristbandHistoryEvent("OnBluetoothDeInitialized", false));
 }
Example #15
0
 public static void ArchiveEvents()
 {
     EventHistory.Add(TodaysEvents);
     TodaysEvents = new List <Event>();
 }
Example #16
0
 private void OnNext(MonitorEvent ev)
 {
     EventHistory.Add(ev);
 }
 public void OnWristbandDisconnected()
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandDisconnected", false));
 }