Skip to content

Commit 06fc826

Browse files
committed
add test for create workflow message but with task and workflow Ids
Signed-off-by: Neil South <[email protected]>
1 parent b5c1cde commit 06fc826

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/WorkflowManager/PayloadListener/Services/PayloadListenerService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ private void SetupPolling()
104104
_logger.EventSubscription(ServiceName, TaskStatusUpdateRoutingKey);
105105

106106
_messageSubscriber.SubscribeAsync(ExportCompleteRoutingKey, ExportCompleteRoutingKey, OnExportCompleteReceivedCallback);
107-
_logger.EventSubscription(ServiceName, ExportCompleteRoutingKey); }
107+
_logger.EventSubscription(ServiceName, ExportCompleteRoutingKey);
108+
}
108109
private async Task OnWorkflowRequestReceivedCallbackAsync(MessageReceivedEventArgs eventArgs)
109110
{
110111

tests/UnitTests/PayloadListener.Tests/Services/EventPayloadRecieverServiceTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,28 @@ public void ExportCompletePayload_ErrorIsThrown_MessageIsRejectedAndRequeued()
276276
_mockMessageBrokerSubscriberService.VerifyNoOtherCalls();
277277
}
278278

279+
[Test]
280+
public void ReceiveWorkflowPayload_With_WorkflowId_And_TaskID()
281+
{
282+
283+
var exportRequestMessage = new WorkflowRequestEvent
284+
{
285+
CorrelationId = Guid.NewGuid().ToString(),
286+
WorkflowInstanceId = Guid.NewGuid().ToString(),
287+
TaskId = "exporttask"
288+
};
289+
var jsonMessage = new JsonMessage<WorkflowRequestEvent>(exportRequestMessage, MessageBrokerConfiguration.WorkflowManagerApplicationId, exportRequestMessage.CorrelationId);
290+
var message = new MessageReceivedEventArgs(jsonMessage.ToMessage(), CancellationToken.None);
291+
292+
_mockEventPayloadValidator.Setup(p => p.ValidateWorkflowRequest(It.IsAny<WorkflowRequestEvent>())).Returns(true);
293+
294+
_workflowExecuterService.Setup(p => p.ProcessPayload(It.IsAny<WorkflowRequestEvent>(), It.IsAny<Payload>())).ReturnsAsync(true);
295+
296+
_eventPayloadReceiverService.ReceiveWorkflowPayload(message);
297+
298+
_payloadService.Verify(p => p.CreateAsync(It.IsAny<WorkflowRequestEvent>()), Times.Never());
299+
}
300+
279301
private static MessageReceivedEventArgs CreateMessageReceivedEventArgs(string[] destinations)
280302
{
281303
var exportRequestMessage = new ExportRequestEvent

0 commit comments

Comments
 (0)