* add a more generic UIHandler to customize how inputAttributes can be handle by the ui * Add IPropertyUIHandlerResolver and update PropertyUIHandlerResolver Introduced a new interface, IPropertyUIHandlerResolver, to resolve UI options for a property. Refactored PropertyUIHandlerResolver to implement this interface and removed the unnecessary partial class structure. Also, cleaned up some unnecessary usings in various files for better code organization. * Refactor variable name and description in InputDescriptor The 'uISpecifications' variable in the InputDescriptor model is renamed to 'uiSpecifications' for better readability. Additionally, the associated comment was revised to explain that the dictionary is used by the UI. * "Refactor codebase for improved organization and cleaner architecture" The codebase has been significantly refactored, moving several classes to more appropriate namespaces for improved organization and cleaner architecture. This includes shifting UI hint handlers, activities, and memory-related components, amongst others. The changes should improve code readability and maintainability, but as this is a broad refactoring effort, thorough regression testing is advised. * Add CheckList UIHint with associated handler and provider This update introduces a new UIHint called CheckList to the Elsa.Workflows.Core. This includes the necessary handler and provider classes. The handler is registered in the WorkflowsFeature.cs, and the CheckList UIHint key has been added to the InputUIHints.cs. Various associated files have been created in both the Elsa.Api.Client and Elsa.Workflows.Core project to support this new UIHint. --------- Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com> Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
48 lines
1.9 KiB
C#
48 lines
1.9 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Elsa.Testing.Shared;
|
|
using Elsa.Workflows.Contracts;
|
|
using Elsa.Workflows.State;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Elsa.IntegrationTests.Scenarios.JsonObjectSerialization;
|
|
|
|
/// <summary>
|
|
/// Tests for serializing and deserializing JSON objects containing reserved keywords such as $id.
|
|
/// </summary>
|
|
public class Tests
|
|
{
|
|
private readonly CapturingTextWriter _capturingTextWriter = new();
|
|
private readonly IServiceProvider _services;
|
|
private readonly IWorkflowStateSerializer _workflowStateSerializer;
|
|
|
|
public Tests(ITestOutputHelper testOutputHelper)
|
|
{
|
|
_services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
|
|
_workflowStateSerializer = _services.GetRequiredService<IWorkflowStateSerializer>();
|
|
}
|
|
|
|
[Fact(DisplayName = "User-objects containing $id don't break deserialization into ExpandoObject.")]
|
|
public async Task Test1()
|
|
{
|
|
// Populate registries.
|
|
await _services.PopulateRegistriesAsync();
|
|
|
|
// Import workflow.
|
|
var workflowFileName = "Scenarios/JsonObjectSerialization/Workflows/instance-serialization.json";
|
|
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync(workflowFileName);
|
|
|
|
// Execute.
|
|
var workflowState = await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId);
|
|
|
|
// Serialize workflow state.
|
|
var serializedWorkflowState = await _workflowStateSerializer.SerializeAsync(workflowState);
|
|
|
|
// Attempt to deserialize workflow state.
|
|
await _workflowStateSerializer.DeserializeAsync<WorkflowState>(serializedWorkflowState);
|
|
|
|
// If we reach this point, the test has passed. Otherwise, an exception would have been thrown.
|
|
}
|
|
} |