admin/tools/ApprovalSmoke/Program.cs
zzh 649b84c1b0
All checks were successful
Build and Deploy / deploy (push) Successful in 1m18s
feat: 新增单级可配置审批引擎与配置/待办 API
一期落地定义、实例、任务、事件及模拟提交通路,业务接入后续再挂 Operation Adapter。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-07 18:27:41 +08:00

26 lines
965 B
C#
Raw Permalink 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.

using Fake.Application;
using Oms.Application.Services.Approval;
using Oms.Application.Services.Approval.Contracts;
// 无库烟测:ID 解析 + 条件求值(空工厂)
var ids = ApprovalIdHelper.SplitIds("a, b; c,d");
if (ids.Count != 4) throw new Exception($"SplitIds failed: {ids.Count}");
if (!ApprovalIdHelper.ContainsId("a,b,c", "B")) throw new Exception("ContainsId case failed");
var evaluator = new ApprovalConditionEvaluator(Array.Empty<IApprovalConditionContextFactory>());
evaluator.EnsureFormulaAllowed("System.Approval.Simulate", null);
try
{
evaluator.EnsureFormulaAllowed("System.Approval.Simulate", "金额 > 1");
throw new Exception("Simulate should reject non-empty formula");
}
catch (BusinessException)
{
// expected
}
var (ok, matched, msg) = evaluator.TryTest("Finance.Recharge.Credit", null, null);
if (!ok || !matched) throw new Exception($"empty formula should match: {msg}");
Console.WriteLine("ApprovalSmoke OK");