refactor(swap-test): 抽取 TestableSwapEodPositionService 公共基类收敛重复 Stub
- 新建 TestableSwapEodPositionService 收敛 8/8 Stub 重复的高频 override (PersistEodSwapPosition/SaveAllChanges/GetCurrencyRate/AddClientCash) + 统一 OptUserInfo 构造 + PersistedPositions/SaveChangesCount 输出捕获 - SwapEodPositionService.DealInterests 改 protected virtual(行为零变化) - 8 个 ScenarioTest 改为继承基类,删除重复 override - 消灭 DealInterestsScenarioTest/DealInterestsGoldenReplayTest 的反射调用 (typeof().GetMethod().Invoke → 直接调用 DealInterests) 验证:dotnet build 0 错误;dotnet test SwapModule 284通过/6跳过/0失败
This commit is contained in:
@@ -212,10 +212,10 @@ namespace YLErp.Modules.SwapModule
|
||||
|
||||
#region 回放用 Stub
|
||||
|
||||
private sealed class ReplayStubService : SwapEodPositionService
|
||||
private sealed class ReplayStubService : TestableSwapEodPositionService
|
||||
{
|
||||
private readonly string _underlyingCode;
|
||||
public ReplayStubService(string underlyingCode) : base(new OptUserInfo(0, "Replay", OptUserFrom.UnitTest))
|
||||
public ReplayStubService(string underlyingCode) : base("Replay")
|
||||
{
|
||||
_underlyingCode = underlyingCode;
|
||||
}
|
||||
@@ -238,9 +238,6 @@ namespace YLErp.Modules.SwapModule
|
||||
return 0m;
|
||||
}
|
||||
|
||||
protected override void SaveAllChanges() { }
|
||||
protected override double GetCurrencyRate(string q, string s, DateTime d, bool p, CurrencyRateType t) => 1.0;
|
||||
|
||||
public eod_swap_position ExecuteUpdateEodPosition(
|
||||
swap_position swapPosition, eod_swap_position eod, trade td,
|
||||
DateTime valueDate, DateTime preSettleDate, List<swap_flow_event> unwindEvents)
|
||||
|
||||
Reference in New Issue
Block a user