public void HandlesEvent_ShouldReturnEventGridEventWithoutEventId_WhenReleventParameterIsFalse()
        {
            // Arrange
            string          eventType = "TEST";
            string          subject   = "TEST_SUBJECT";
            ResponseBaseDTO dto       = new ResponseAcknowledgeDTO(eventType);

            // Act
            var result = _handler.GetEventGridEventFromResponseDTO(dto, subject, false);

            // Assert
            result.Subject.ShouldBe(subject);
        }
Beispiel #2
0
        private async Task AcknowledgeRequestEvent(EventGridEvent eventGridEvent, JObject operationContext)
        {
            var responseAck = new ResponseAcknowledgeDTO(eventGridEvent.EventType)
            {
                OperationContext = operationContext
            };
            var ackEvent = GetEventGridEventFromResponseDTO(responseAck, eventGridEvent.Subject);

            var isAck = await PublishEventToTopicAsync(ackEvent, eventGridEvent).ConfigureAwait(false);

            if (!isAck)
            {
                Log.LogEventObject(LogEventIds.FailedToAcknowledge, eventGridEvent);
            }
        }
        public void HandlesEvent_ShouldReturnEventGridEventWithoutEventId_WhenReleventParameterIsTrue()
        {
            // Arrange
            string          eventType = "TEST";
            string          subject   = "TEST_SUBJECT";
            ResponseBaseDTO dto       = new ResponseAcknowledgeDTO(eventType);

            // Act
            var result = _handler.GetEventGridEventFromResponseDTO(dto, subject);

            // Assert
            var subjectParts = result.Subject.Split("/");

            subjectParts[0].ShouldBe(subject);
            Guid.TryParse(subjectParts[1], out _).ShouldBe(true);
        }