namespace BuildFlow.Architecture.Tests; using Xunit; /// /// BuildFlow 低代码后台入口种子约束。保证干净库自动具备表单、按钮、函数管理菜单。 /// public class BuildFlowEntrySeedTests { [Fact] public void PlatformSeedDataShouldContainBuildFlowMetadataMenus() { var seedData = ReadPlatformSeedData(); Assert.Contains("\"buildflow\"", seedData, StringComparison.Ordinal); Assert.Contains("\"buildflow.forms\"", seedData, StringComparison.Ordinal); Assert.Contains("\"/buildflow/forms/index\"", seedData, StringComparison.Ordinal); Assert.Contains("\"buildflow.buttons\"", seedData, StringComparison.Ordinal); Assert.Contains("\"/buildflow/buttons/index\"", seedData, StringComparison.Ordinal); // 脚本函数菜单已迁移至独立的 Scripting 模块(原 buildflow.functions → scripts) Assert.Contains("\"scripts\"", seedData, StringComparison.Ordinal); Assert.Contains("\"/scripts/index\"", seedData, StringComparison.Ordinal); } private static string ReadPlatformSeedData() { var repoRoot = FindRepoRoot(); var seedPath = Path.Combine( repoRoot.FullName, "src", "modules", "platform", "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,架构测试无法确定仓库边界。"); } }