2026-07-24 12:29:06 +08:00

56 lines
1.9 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 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 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,架构测试无法确定仓库边界。");
}
}