ISO 8601 时间统一转换为北京时间,例如 2026/07/23 22:29。 审计日志、缴费确认时间、通知发布时间统一使用时间格式化。 管理员层级、流程类型、录取状态等建立统一中文映射。 工作台、流程设计、学校管理等管理页面的装饰性英文标题改为中文。 历史审计记录中的 plan、draft 等枚举也会自动翻译。 更新静态资源版本号,避免浏览器继续使用旧缓存。
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using System.Text.Json.Nodes;
|
|
using Eis.Infrastructure.Administration;
|
|
|
|
namespace Eis.Infrastructure.Tests.Administration;
|
|
|
|
public sealed class AdminNoticeServiceTests
|
|
{
|
|
[Theory]
|
|
[InlineData("publicVisible")]
|
|
[InlineData("visible")]
|
|
public void TryReadPublicVisibility_AcceptsCurrentAndLegacyKeys(string key)
|
|
{
|
|
var body = new JsonObject { [key] = false };
|
|
|
|
var parsed = AdminNoticeService.TryReadPublicVisibility(body, out var visible);
|
|
|
|
Assert.True(parsed);
|
|
Assert.False(visible);
|
|
}
|
|
|
|
[Fact]
|
|
public void TryReadPublicVisibility_RejectsMissingOrNonBooleanValue()
|
|
{
|
|
Assert.False(AdminNoticeService.TryReadPublicVisibility(new JsonObject(), out _));
|
|
Assert.False(AdminNoticeService.TryReadPublicVisibility(
|
|
new JsonObject { ["publicVisible"] = "false" },
|
|
out _));
|
|
}
|
|
|
|
[Fact]
|
|
public void PublicationProjector_ExposesConsistentVisibilityFields()
|
|
{
|
|
var payload = new JsonObject
|
|
{
|
|
["publicVisible"] = false,
|
|
["reviewedAt"] = "2026-07-23T00:00:00.000Z"
|
|
};
|
|
var snapshot = new AdminNoticeManagementSnapshot(
|
|
[],
|
|
[new AdminPublicationRecord(
|
|
"plan_1", "plan", "exam_1", null, "school_1", "approved", payload,
|
|
"2026-07-23T00:00:00.000Z", "2026-07-23T00:00:00.000Z")],
|
|
new Dictionary<string, string> { ["exam_1"] = "统一考试" },
|
|
new Dictionary<string, string> { ["school_1"] = "第一中学" });
|
|
|
|
var publication = Assert.Single(AdminPublicationProjector.Build(snapshot));
|
|
|
|
Assert.False(publication["publicVisible"]!.GetValue<bool>());
|
|
Assert.False(publication["visible"]!.GetValue<bool>());
|
|
Assert.Equal("hidden", publication["status"]!.GetValue<string>());
|
|
}
|
|
}
|