test(engine-ambient): TestBattleScope + HeadlessFixture split for multi-instance

Step 6 of multi-instancing migration. HeadlessEngineEnv.EnsureInitialized
is split into EnsureProcessGlobals (idempotent, process-once) +
SeedCharaIdsOnCurrentAmbient (per-test). New TestBattleScope IDisposable
sets up a fresh BattleAmbientContext per test. NonParallelizable removed
from converted classes; assembly-level Parallelizable(Fixtures) enabled.

SVSim.BattleEngine.Tests fully green under parallel test execution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 22:24:21 -04:00
parent 1ba75c565a
commit 8af1be6555
22 changed files with 238 additions and 39 deletions

View File

@@ -12,6 +12,11 @@ namespace SVSim.BattleEngine.Tests
[TestFixture]
public class EmitPathReadOracleTests : NetworkEmitFixtureBase
{
private TestBattleScope _scope;
[SetUp] public void SetUpScope() { _scope = new TestBattleScope(); }
[TearDown] public void TearDownScope() { _scope?.Dispose(); _scope = null; }
// The process-global reset (IsForecast=true + clear injected agent) now lives in the shared
// NetworkEmitFixtureBase.ResetNetworkEmitGlobals [TearDown], inherited here — see that file
// for why the leak matters.
@@ -20,6 +25,7 @@ namespace SVSim.BattleEngine.Tests
public void M3_spell_driven_via_OperateMgr_reaches_emit_without_crashing()
{
var (mgr, emitted) = HeadlessEngineEnv.NewNetworkEmitBattle();
_scope.Ctx.Mgr = mgr;
var player = mgr.BattlePlayer;
var enemy = mgr.BattleEnemy;