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:
@@ -11,13 +11,18 @@ namespace SVSim.BattleEngine.Tests
|
||||
[TestFixture]
|
||||
public class NetworkMgrConstructionProbeTests : NetworkEmitFixtureBase
|
||||
{
|
||||
private TestBattleScope _scope;
|
||||
|
||||
[SetUp] public void SetUpScope() { _scope = new TestBattleScope(); }
|
||||
[TearDown] public void TearDownScope() { _scope?.Dispose(); _scope = null; }
|
||||
|
||||
[Test]
|
||||
public void HeadlessNetworkBattleMgr_constructs_headless()
|
||||
{
|
||||
HeadlessEngineEnv.EnsureInitialized();
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var mgr = new HeadlessNetworkBattleMgr(new HeadlessContentsCreator());
|
||||
_scope.Ctx.Mgr = mgr;
|
||||
Assert.That(mgr, Is.Not.Null);
|
||||
});
|
||||
}
|
||||
@@ -26,6 +31,7 @@ namespace SVSim.BattleEngine.Tests
|
||||
public void OnEmit_capture_seam_is_wired_via_injected_agent()
|
||||
{
|
||||
var (mgr, emitted) = HeadlessEngineEnv.NewNetworkEmitBattle();
|
||||
_scope.Ctx.Mgr = mgr;
|
||||
Assert.That(mgr, Is.Not.Null);
|
||||
Assert.That(Wizard.ToolboxGame.RealTimeNetworkAgent, Is.Not.Null,
|
||||
"agent must be injected so NetworkBattleSender's ToolboxGame.RealTimeNetworkAgent.* calls resolve");
|
||||
|
||||
Reference in New Issue
Block a user