elsa-core/test/unit/Elsa.Persistence.VNext.UnitTests/DocumentDatabasePlanningTests.cs
Sipke Schoorstra c16995014c
Add Persistence vNext provider-neutral POC
Adds the Persistence vNext proof of concept, including provider-neutral schema/document abstractions, relational and document provider POCs, Elsa integration, runtime-defined entities, physicalization planning, workflow runtime evaluation, and focused tests.
2026-06-02 21:05:21 +02:00

26 lines
1.1 KiB
C#

using Elsa.Persistence.VNext.Document;
using Elsa.Secrets.Persistence.VNext;
namespace Elsa.Persistence.VNext.UnitTests;
public class DocumentDatabasePlanningTests
{
private readonly SecretPersistenceSchemaProvider _schemaProvider = new();
private readonly DocumentDatabasePlanner _planner = new();
[Fact]
public void DocumentPlanner_ProducesCollectionPlanFromSecretsIntent()
{
var plan = _planner.Plan(_schemaProvider.DescribeSchema());
var collection = Assert.Single(plan.Collections);
Assert.Equal("Secrets", collection.Name);
Assert.Equal("Elsa", collection.Namespace);
Assert.Equal(["Id"], collection.KeyFields);
Assert.Equal(12, collection.Fields.Count);
Assert.Contains(collection.Fields, x => x.Name == "Versions" && x.Type == PersistenceColumnType.Json && !x.IsNullable);
Assert.Contains(collection.Indexes, x => x.Name == "IX_Secret_Name" && x.IsUnique && x.Fields.SequenceEqual(["Name"]));
Assert.Contains(collection.Indexes, x => x.Name == "IX_Secret_Status" && x.Fields.SequenceEqual(["Status"]));
}
}