build-flow.api/tests/BuildFlow.Architecture.Tests/BuildFlowFormComponentSeedTests.cs
2026-07-24 12:29:06 +08:00

50 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace BuildFlow.Architecture.Tests;
using Xunit;
/// <summary>
/// BuildFlow 表单组件种子约束。保证干净库可创建前端设计器内置的运行时字段。
/// </summary>
public class BuildFlowFormComponentSeedTests
{
[Fact]
public void WorkflowSeedDataShouldContainRelationPickerComponent()
{
var seedData = ReadWorkflowSeedData();
Assert.Contains("RelationPicker", seedData, StringComparison.Ordinal);
Assert.Contains("\"x-field-kind\":\"relation\"", seedData, StringComparison.Ordinal);
}
private static string ReadWorkflowSeedData()
{
var repoRoot = FindRepoRoot();
var seedPath = Path.Combine(
repoRoot.FullName,
"src",
"modules",
"workflow",
"Infrastructure",
"Persistence",
"SeedData.cs");
return System.IO.File.ReadAllText(seedPath);
}
private static DirectoryInfo FindRepoRoot()
{
var current = new DirectoryInfo(AppContext.BaseDirectory);
while (current is not null)
{
if (System.IO.File.Exists(Path.Combine(current.FullName, "BuildFlow.slnx")))
{
return current;
}
current = current.Parent;
}
throw new InvalidOperationException("无法定位 BuildFlow.slnx,架构测试无法确定仓库边界。");
}
}