namespace BuildFlow.Architecture.Tests; using Xunit; /// /// BuildFlow 表单组件种子约束。保证干净库可创建前端设计器内置的运行时字段。 /// 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 File.ReadAllText(seedPath); } private static DirectoryInfo FindRepoRoot() { var current = new DirectoryInfo(AppContext.BaseDirectory); while (current is not null) { if (File.Exists(Path.Combine(current.FullName, "BuildFlow.slnx"))) { return current; } current = current.Parent; } throw new InvalidOperationException("无法定位 BuildFlow.slnx,架构测试无法确定仓库边界。"); } }