diff --git a/NuGet.Config b/NuGet.Config index 6a0629d8a..36cf83e1b 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -11,8 +11,6 @@ - - diff --git a/test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Primitives/Event/PublishEventTests.cs b/test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Primitives/Event/PublishEventTests.cs index b1390b510..da6ee232f 100644 --- a/test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Primitives/Event/PublishEventTests.cs +++ b/test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Primitives/Event/PublishEventTests.cs @@ -1,3 +1,4 @@ +using System.Linq; using System.Text.Json; using Elsa.Common.Models; using Elsa.Testing.Shared; @@ -74,10 +75,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 property) + { + var candidate = element.EnumerateObject() + .Where(candidate => candidate.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + .FirstOrDefault(); + if (candidate.Value.ValueKind == JsonValueKind.Undefined) + { + property = default; + return false; + } + + property = candidate.Value; + return true; + } + private async Task GetSingleWorkflowInstanceAsync(string definitionId, string correlationId, int timeoutMs = 5000) { var tcs = new TaskCompletionSource();