59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
namespace BuildFlow.Architecture.Tests;
|
||
|
||
using Xunit;
|
||
|
||
/// <summary>
|
||
/// IM 后台入口种子约束。保证干净库自动具备聊天菜单与会话操作权限。
|
||
/// </summary>
|
||
public class ImEntrySeedTests
|
||
{
|
||
[Fact]
|
||
public void PlatformSeedDataShouldContainImConversationManagePermission()
|
||
{
|
||
var seedData = ReadPlatformSeedData();
|
||
|
||
Assert.Contains("\"im:conversation:manage\"", seedData, StringComparison.Ordinal);
|
||
}
|
||
|
||
[Fact]
|
||
public void PlatformSeedDataShouldContainImChatMenuEntry()
|
||
{
|
||
var seedData = ReadPlatformSeedData();
|
||
|
||
Assert.Contains("\"im\"", seedData, StringComparison.Ordinal);
|
||
Assert.Contains("\"im.chat\"", seedData, StringComparison.Ordinal);
|
||
Assert.Contains("\"/im/chat/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,架构测试无法确定仓库边界。");
|
||
}
|
||
}
|