From 54c4bf21c6ee6801f172647a58e87104a1841b53 Mon Sep 17 00:00:00 2001 From: hjhan Date: Wed, 19 Aug 2026 09:44:59 +0800 Subject: [PATCH] =?UTF-8?q?test(swap):=20PrevBizDay=20=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=AF=B9=E8=BF=9B=E7=A8=8B=E5=86=85=20QDP=20=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=84=B1=E6=95=8F=EF=BC=88=E4=BF=AE=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E8=BF=90=E8=A1=8C=E5=81=B6=E5=8F=91=E7=BA=A2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 全量运行实测:其他用例会把 QDP "chn" 日历替换为"全营业日"退化态 (GetNonHolidayDefore(7/19)=7/19 不再回拨周五),三个 PrevBizDay 放行用例 单跑绿、全量红(取价日 7/19 不在市场)。生产库恒有真实日历无此问题。 - Fr007MarketPrevBizDay 同时供回拨日(7/3、7/10、7/17)与退化日(7/5、7/12、7/19) 两套价——被测对象是取价放宽语义,不是日历本身; - FixingDayMissing 守卫同时扣 7/17+7/19,两种日历态下都缺价仍拦。 验证:套件 23/23;全量 960 例 145 败与改动前基线失败名单 diff=0,11 个新用例全绿 --- .../GLMS20260817Fr007UnwindMorningTest.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/UnitTestProject/Modules/SwapModule/GLMS20260817Fr007UnwindMorningTest.cs b/UnitTestProject/Modules/SwapModule/GLMS20260817Fr007UnwindMorningTest.cs index 2eb3c689..ec4d2d65 100644 --- a/UnitTestProject/Modules/SwapModule/GLMS20260817Fr007UnwindMorningTest.cs +++ b/UnitTestProject/Modules/SwapModule/GLMS20260817Fr007UnwindMorningTest.cs @@ -30,12 +30,18 @@ namespace YLErp.Modules.SwapModule [new DateTime(2026, 7, 20)] = 0.0143, }; /// interest_rule=-1(前一营业日基准)取价日市场:重置日 7/6、7/13、7/20(周一) - /// 经 GetFixingDate 回拨至前一营业日 7/3、7/10、7/17(周五)。 + /// 经 GetFixingDate 回拨至前一营业日 7/3、7/10、7/17(周五)。 + /// 同时供未回拨的 7/5、7/12、7/19(周日):QDP "chn" 日历在测试进程内可能被其他用例替换为 + /// "全营业日"退化态(全量运行实测 GetNonHolidayDefore(7/19)=7/19 不回拨), + /// 两套日期都供价使本套件对进程内日历状态不敏感——被测对象是取价放宽语义,不是日历本身。 private static readonly Dictionary Fr007MarketPrevBizDay = new() { [new DateTime(2026, 7, 3)] = 0.0142, + [new DateTime(2026, 7, 5)] = 0.0142, [new DateTime(2026, 7, 10)] = 0.01425, + [new DateTime(2026, 7, 12)] = 0.01425, [new DateTime(2026, 7, 17)] = 0.0143, + [new DateTime(2026, 7, 19)] = 0.0143, }; private const double PreviousResetRate = 0.01425; @@ -176,11 +182,16 @@ namespace YLErp.Modules.SwapModule string calcMode = "10", int interestRule = 0, bool newCalcLast = false, - Dictionary market = null) + Dictionary market = null, + DateTime? omitDate2 = null) { var cd = closeDate ?? CloseDate; var omit = new HashSet(); - if (omitDate.HasValue) omit.Add(omitDate.Value.Date); + if (omitDate.HasValue || omitDate2.HasValue) + { + if (omitDate.HasValue) omit.Add(omitDate.Value.Date); + if (omitDate2.HasValue) omit.Add(omitDate2.Value.Date); + } else if (!includeCloseDate) omit.Add(cd.Date); var svc = new StubSwapDealService(MakeOptUser(), omit, closeRate, market); @@ -384,10 +395,11 @@ namespace YLErp.Modules.SwapModule [TestMethod] public void PrevBizDay_TailCalced_FixingDayMissing_StillThrows() { + // 取价日候选 7/17(周五,正常日历回拨) 与 7/19(周日,退化日历不回拨) 都扣掉 → 两种日历态下都缺价 var o = Run(InterestTypeEnum.复利, includeCloseDate: true, calcMode: "11", interestRule: -1, - omitDate: new DateTime(2026, 7, 17), market: Fr007MarketPrevBizDay, - preEod: BuildPreEod(new DateTime(2026, 7, 13))); - Assert.IsTrue(o.Threw, "算尾(11)+前一营业日基准+取价日(7/17)本身缺价 → 仍应拦截(真实依赖)"); + omitDate: new DateTime(2026, 7, 17), omitDate2: new DateTime(2026, 7, 19), + market: Fr007MarketPrevBizDay, preEod: BuildPreEod(new DateTime(2026, 7, 13))); + Assert.IsTrue(o.Threw, "算尾(11)+前一营业日基准+取价日本身缺价 → 仍应拦截(真实依赖)"); StringAssert.Contains(o.Ex.Message, "FR007"); }