test(battle-node): rename ScriptedBotCtx test helper to FakeOpponentCtx
Pure private-helper rename in the two lifecycle test fixtures for lexical hygiene — matches the kept ServerBattleFrames.FakeOpponentViewerId. The fixture is a fake opponent MatchContext, never a "scripted bot". No behavior change; both fixtures green (20/20). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ public class ServerBattleFramesTests
|
||||
[Test]
|
||||
public void BuildMatched_PutsOppoIdInSelfInfoEqualToTheRealOpponentVid()
|
||||
{
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), ScriptedBotCtx(),
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), FakeOpponentCtx(),
|
||||
selfViewerId: 906243102, oppoViewerId: 847666884,
|
||||
battleId: "b", seed: BattleFrameDefaults.BattleSeed);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ServerBattleFramesTests
|
||||
[Test]
|
||||
public void BuildMatched_ContainsThirtyCardSelfDeck()
|
||||
{
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), ScriptedBotCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), FakeOpponentCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var body = (MatchedBody)env.Body;
|
||||
Assert.That(body.SelfDeck.Count, Is.EqualTo(30));
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class ServerBattleFramesTests
|
||||
public void BuildMatched_deck_idxs_pair_1to30_with_context_card_ids()
|
||||
{
|
||||
var draftedDeck = Enumerable.Range(1, 30).Select(i => 200_000_000L + i).ToList();
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(draftedDeck), ScriptedBotCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(draftedDeck), FakeOpponentCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var body = (MatchedBody)env.Body;
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
@@ -56,7 +56,7 @@ public class ServerBattleFramesTests
|
||||
EmblemId = "888", DegreeId = "777", FieldId = 42, IsOfficial = 1,
|
||||
};
|
||||
|
||||
var env = ServerBattleFrames.BuildMatched(ctx, ScriptedBotCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var env = ServerBattleFrames.BuildMatched(ctx, FakeOpponentCtx(), 1, 2, "b", BattleFrameDefaults.BattleSeed);
|
||||
var body = (MatchedBody)env.Body;
|
||||
|
||||
Assert.That(body.SelfInfo.CountryCode, Is.EqualTo("JPN"));
|
||||
@@ -71,7 +71,7 @@ public class ServerBattleFramesTests
|
||||
[Test]
|
||||
public void BuildBattleStart_HasTurnStateZero_AndUsesContextBattleType()
|
||||
{
|
||||
var env = ServerBattleFrames.BuildBattleStart(FixtureCtx(), ScriptedBotCtx(), selfViewerId: 1, turnState: 0);
|
||||
var env = ServerBattleFrames.BuildBattleStart(FixtureCtx(), FakeOpponentCtx(), selfViewerId: 1, turnState: 0);
|
||||
var body = (BattleStartBody)env.Body;
|
||||
Assert.That(body.TurnState, Is.EqualTo(0));
|
||||
Assert.That(body.BattleType, Is.EqualTo(11));
|
||||
@@ -87,7 +87,7 @@ public class ServerBattleFramesTests
|
||||
BattleType = 42,
|
||||
};
|
||||
|
||||
var env = ServerBattleFrames.BuildBattleStart(ctx, ScriptedBotCtx(), selfViewerId: 1, turnState: 0);
|
||||
var env = ServerBattleFrames.BuildBattleStart(ctx, FakeOpponentCtx(), selfViewerId: 1, turnState: 0);
|
||||
var body = (BattleStartBody)env.Body;
|
||||
|
||||
Assert.That(body.SelfInfo.ClassId, Is.EqualTo("7"));
|
||||
@@ -175,7 +175,7 @@ public class ServerBattleFramesTests
|
||||
|
||||
// A prod-captured opponent MatchContext fixture that the BuildMatched/BuildBattleStart
|
||||
// helpers read from for the oppo half.
|
||||
private static MatchContext ScriptedBotCtx() => new(
|
||||
private static MatchContext FakeOpponentCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 0L).ToList(),
|
||||
ClassId: "8", CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "Opponent", SleeveId: "704141010",
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TypedBodyWireShapeTests
|
||||
// Matching.StartBattleLoad reads it back, and GetSelfDeck().Select(...) crashes
|
||||
// with "Value cannot be null. Parameter name: source". The prod wire format
|
||||
// emits envelope keys (uri first) before body keys; we must too.
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), ScriptedBotCtx(),
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), FakeOpponentCtx(),
|
||||
selfViewerId: 1, oppoViewerId: 2, battleId: "b", seed: BattleFrameDefaults.BattleSeed);
|
||||
var json = MsgEnvelope.ToJson(env);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TypedBodyWireShapeTests
|
||||
[Test]
|
||||
public void BuildMatched_SerializesAllWireKeysExpectedByTheClient()
|
||||
{
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), ScriptedBotCtx(),
|
||||
var env = ServerBattleFrames.BuildMatched(FixtureCtx(), FakeOpponentCtx(),
|
||||
selfViewerId: 906243102, oppoViewerId: 847666884, battleId: "597830888107",
|
||||
seed: BattleFrameDefaults.BattleSeed);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class TypedBodyWireShapeTests
|
||||
[Test]
|
||||
public void BuildBattleStart_SerializesAllWireKeysAndPreservesBattlePointAsymmetry()
|
||||
{
|
||||
var env = ServerBattleFrames.BuildBattleStart(FixtureCtx(), ScriptedBotCtx(), selfViewerId: 906243102, turnState: 0);
|
||||
var env = ServerBattleFrames.BuildBattleStart(FixtureCtx(), FakeOpponentCtx(), selfViewerId: 906243102, turnState: 0);
|
||||
|
||||
var json = MsgEnvelope.ToJson(env);
|
||||
var node = JsonNode.Parse(json)!.AsObject();
|
||||
@@ -163,7 +163,7 @@ public class TypedBodyWireShapeTests
|
||||
// cosmetics (ClassId/CharaId "8") so the wire bytes asserted below (oppoInfo classId/charaId,
|
||||
// oppoDeckCount=30, etc.) remain byte-identical after the BuildMatched/BuildBattleStart
|
||||
// signature change.
|
||||
private static MatchContext ScriptedBotCtx() => new(
|
||||
private static MatchContext FakeOpponentCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 0L).ToList(),
|
||||
ClassId: "8", CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "Opponent", SleeveId: "704141010",
|
||||
|
||||
Reference in New Issue
Block a user