50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
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,架构测试无法确定仓库边界。");
|
||
}
|
||
}
|