test: 补全 SaveAutoSwapDeal 的测试 seam——修复6个AS_*测试失败

- SwapEodPositionService: AddSwapEvent 虚方法(已存在)替换 line 741 的 new SwapEventService 直调

- SwapEodPositionService: 新增 PersistFlowEvent 虚方法,替换 line 749/760 的 DbContext.swap_flow_event.Add 直调

- TestableSwapEodPositionService: PersistFlowEvent 改为 override

- BondTrsAutoSwapScenarioTest.AutoSwapEodService: override PersistFlowEvent 同步到 PersistedFlowEvents

测试: 511→517 通过,7→0 失败
This commit is contained in:
hjhan
2026-08-12 18:23:51 +08:00
parent 84820a3203
commit dfdc890749
3 changed files with 24 additions and 5 deletions
@@ -124,6 +124,17 @@ namespace YLErp.Modules.SwapModule
return new swap_event { id = SwapEvents.Count };
}
/// <summary>
/// 捕获 SaveAutoSwapDeal 落库的 flow_event(生产写 DbContext.swap_flow_event)。
/// 同步到 PersistedFlowEvents 供 AS_009/010/011 断言;基类 FlowEvents 仍由它填充,
/// 供 GetConsumedInterest 真实计算已结利息。
/// </summary>
protected override void PersistFlowEvent(swap_flow_event flowEvent)
{
base.PersistFlowEvent(flowEvent);
PersistedFlowEvents.Add(flowEvent);
}
/// <summary>
/// 利息腿金额直接给定(付息金额),避免把 GetInterests 的计息细节混入本用例——
/// 本文件关注的是「自动互换是否触发 / 几条 / 资金发生日 / 金额量级」,
@@ -62,7 +62,7 @@ namespace YLErp.Modules.SwapModule
/// 捕获真实收盘产生的 swap_flow_event(生产写 DbContext.swap_flow_event)。
/// 与 PersistEodSwapPosition 同理,这里只收集不写库,供 GetConsumedInterest 真实计算。
/// </summary>
protected void PersistFlowEvent(swap_flow_event flowEvent)
protected override void PersistFlowEvent(swap_flow_event flowEvent)
{
if (flowEvent.id == 0) flowEvent.id = _nextId++;
FlowEvents.Add(flowEvent);