Fix publish event payload assertion casing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Sipke Schoorstra 2026-06-21 23:18:28 +02:00
parent 571c1c7b2c
commit 5cc2a7c75a
No known key found for this signature in database
GPG key ID: 5C10502B28A4268F

View file

@ -74,10 +74,25 @@ public class PublishEventTests : AppComponentTest
// Verify the payload structure and content
using var payloadDocument = JsonDocument.Parse(JsonSerializer.Serialize(receivedPayload));
Assert.True(payloadDocument.RootElement.TryGetProperty("Status", out var status), "Received payload should contain a Status property");
Assert.True(TryGetProperty(payloadDocument.RootElement, "Status", out var status), "Received payload should contain a Status property");
Assert.Equal("Shipped", status.GetString());
}
private static bool TryGetProperty(JsonElement element, string propertyName, out JsonElement value)
{
foreach (var property in element.EnumerateObject())
{
if (string.Equals(property.Name, propertyName, StringComparison.OrdinalIgnoreCase))
{
value = property.Value;
return true;
}
}
value = default;
return false;
}
private async Task<WorkflowInstance> GetSingleWorkflowInstanceAsync(string definitionId, string correlationId, int timeoutMs = 5000)
{
var tcs = new TaskCompletionSource<WorkflowInstance>();