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"); }