Merge branch 'glms/feature/0812_zmr_divPower' into 'glms/feature/1.4.2'

feat(swap): 添加公司行为现金分红按登记日权益数量计算功能

See merge request otc-dev/zszq-trs!16
This commit is contained in:
张名锐
2026-08-26 02:35:03 +00:00
3 changed files with 69 additions and 12 deletions
@@ -66,5 +66,23 @@ namespace YLErp.Modules.EodModule
Assert.AreEqual(204000m, actual);
}
[TestMethod]
public void CalcPayment_CorporateActionUsesPreCorporateActionQuantity()
{
var payments = new List<BondPayment>
{
new BondPayment { payment_interest = 2m },
new BondPayment { payment_interest = 10m, IsCorporateActionCashDividend = true }
};
var method = typeof(BondPaymentService).GetMethod(
nameof(BondPaymentService.CalcPayment),
new[] { typeof(List<BondPayment>), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal?) });
Assert.IsNotNull(method, "公司行为现金分红需要支持单独传入除权前数量。");
var actual = (decimal)method.Invoke(CreateService(), new object[] { payments, 2000m, 1m, 1m, (decimal?)1000m });
Assert.AreEqual(1040m, actual, "原生付息按当前 2000 份计算为 40,公司行为分红按除权前 1000 份计算为 1000。");
}
}
}