From 84820a3203844ea38831760b2571bc1af4540904 Mon Sep 17 00:00:00 2001 From: hjhan Date: Wed, 12 Aug 2026 18:08:47 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E5=A4=8D=E9=A2=84=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=B5=8B=E8=AF=95=E5=A4=B1=E8=B4=A5-AddClientCashInCa?= =?UTF-8?q?shOut=20no-op=20override=20+=20FR007=E5=8F=96=E4=BB=B7=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TestableSwapEodPositionService: override AddClientCashInCashOut 与 AddClientCash 同构 no-op,修复6个AS_*测试客户信息未找到异常 - GLMS20260805ClosePercentDiffDiagnoseTest: FR007取价失败走 Inconclusive(与连不上库同语义,外部数据依赖不应判为测试失败) AS_* 仍有深层失败(自动互换未触发,interestList=0),属预存在的测试数据问题,需单独排查 --- .../GLMS20260805ClosePercentDiffDiagnoseTest.cs | 15 +++++++++++++-- .../SwapModule/TestableSwapEodPositionService.cs | 11 +++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) 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++; + } } }