diff --git a/UnitTestProject/Modules/SwapModule/GLMS20260805ClosePercentDiffDiagnoseTest.cs b/UnitTestProject/Modules/SwapModule/GLMS20260805ClosePercentDiffDiagnoseTest.cs index 8d34bc48..6bccc538 100644 --- a/UnitTestProject/Modules/SwapModule/GLMS20260805ClosePercentDiffDiagnoseTest.cs +++ b/UnitTestProject/Modules/SwapModule/GLMS20260805ClosePercentDiffDiagnoseTest.cs @@ -246,8 +246,19 @@ namespace YLErp.Modules.SwapModule var valueDate = DateTime.Today; var unwindDate = DateTime.Today; - var interests100 = new SwapDealService(user).GetUnwindInterests(valueDate, unwindDate, td.id, cp100_B, (int)SwapEventTypeEnum.平仓); - var interests40 = new SwapDealService(user).GetUnwindInterests(valueDate, unwindDate, td.id, cp40_B, (int)SwapEventTypeEnum.平仓); + // FR007 fixing 是外部数据依赖:非交易日/数据未发布时取价会抛 Exception。 + // 与"连不上库自动 Inconclusive"同语义——外部数据不可用不应判为测试失败。 + List interests100, interests40; + try + { + interests100 = new SwapDealService(user).GetUnwindInterests(valueDate, unwindDate, td.id, cp100_B, (int)SwapEventTypeEnum.平仓); + interests40 = new SwapDealService(user).GetUnwindInterests(valueDate, unwindDate, td.id, cp40_B, (int)SwapEventTypeEnum.平仓); + } + catch (Exception ex) when (ex.Message.Contains("获取不到") && ex.Message.Contains("价格")) + { + Assert.Inconclusive($"FR007 fixing 数据不可用({valueDate:yyyy-MM-dd} 非交易日或数据未发布):{ex.Message}"); + return; + } PrintInterestComparison(interests100, interests40, cp100_B, cp40_B); } diff --git a/UnitTestProject/Modules/SwapModule/TestableSwapEodPositionService.cs b/UnitTestProject/Modules/SwapModule/TestableSwapEodPositionService.cs index 6539abe3..55518401 100644 --- a/UnitTestProject/Modules/SwapModule/TestableSwapEodPositionService.cs +++ b/UnitTestProject/Modules/SwapModule/TestableSwapEodPositionService.cs @@ -83,5 +83,16 @@ namespace YLErp.Modules.SwapModule ClientCashCalls.Add((amount, action)); return _nextId++; } + + /// + /// AddClientCashInCashOut 生产实现会查 DataCacheProvider.GetClientDataSource().GetData(ClientId), + /// 纯内存测试无客户缓存会抛"客户信息未找到"。与 AddClientCash 同构 no-op, + /// 仅捕获调用记录,供断言使用。 + /// + public override int AddClientCashInCashOut(OtcTradeBase td, double amount, string action, DateTime valueDate) + { + ClientCashCalls.Add((amount, action)); + return _nextId++; + } } }