* Incremental work * Refactor code for JSON object handling and workflow context This commit includes a significant rework of JSON object handling by ensuring produced JsonObject remains as JsonObject. Previously unimplemented customer and order workflow context providers have been removed. The test cases have been renamed and updated to confirm the new behavior is working as expected.
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Elsa.IntegrationTests.Scenarios.JsonObjectToObjectRemainsJsonObject.Workflows;
|
|
using Elsa.Testing.Shared;
|
|
using Elsa.Workflows.Core.Contracts;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Elsa.IntegrationTests.Scenarios.JsonObjectToObjectRemainsJsonObject;
|
|
|
|
public class JsonObjectJintTests
|
|
{
|
|
private readonly IWorkflowRunner _workflowRunner;
|
|
private readonly CapturingTextWriter _capturingTextWriter = new();
|
|
private readonly IServiceProvider _services;
|
|
|
|
public JsonObjectJintTests(ITestOutputHelper testOutputHelper)
|
|
{
|
|
_services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
|
|
_services.GetRequiredService<IWorkflowBuilderFactory>();
|
|
_workflowRunner = _services.GetRequiredService<IWorkflowRunner>();
|
|
}
|
|
|
|
[Fact(DisplayName = "The produced JsonObject remains JsonObject and does not become JsonElement (which does not support index notation)")]
|
|
public async Task Test1()
|
|
{
|
|
await _services.PopulateRegistriesAsync();
|
|
await _workflowRunner.RunAsync<TestWorkflow>();
|
|
var lines = _capturingTextWriter.Lines.ToList();
|
|
Assert.Equal(new[] { "Baz" }, lines);
|
|
}
|
|
} |