/// <inheritdoc/>
        public bool RaiseEventReceivedEvent(EventGridEventModel model)
        {
            if (string.IsNullOrWhiteSpace(model.EventType) || string.IsNullOrWhiteSpace(model.Subject))
            {
                return(false);
            }

            var eventGridViewerEventModel = _eventGridEventModelAdapter.Convert(model);

            EventReceived?.Invoke(this, new EventGridEventArgs(eventGridViewerEventModel));
            return(true);
        }
        public void EventGridEventModelAdapterConvertCanConvertEventGridEventModel()
        {
            // Arrange
            IAdapter <EventGridEventModel, EventGridViewerEventModel> adapter = new EventGridEventModelAdapter();
            var eventGridEventModel = new EventGridEventModel()
            {
                Data = "SomeJson", EventType = "SomeEventType", Id = "SomeId", Subject = "SomeSubject"
            };

            // Act
            var eventGridViewerEventModel = adapter.Convert(eventGridEventModel);

            // Assert
            Assert.True(eventGridEventModel.Id == eventGridViewerEventModel.Id && eventGridEventModel.Subject == eventGridViewerEventModel.Subject &&
                        eventGridEventModel.EventType == eventGridViewerEventModel.EventType && eventGridEventModel.Data == eventGridViewerEventModel.Data &&
                        eventGridEventModel.EventTime == eventGridViewerEventModel.EventTime);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Handle EventGrid Event
 /// </summary>
 /// <param name="EventGridEventModel"></param>
 private void HandleEvent(EventGridEventModel model)
 {
     _eventGridService.RaiseEventReceivedEvent(model);
 }