feat(battle-node): ScriptedLifecycle frame builders (Path-A static opponent)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using NUnit.Framework;
|
||||
using SVSim.BattleNode.Lifecycle;
|
||||
using SVSim.BattleNode.Protocol;
|
||||
|
||||
namespace SVSim.UnitTests.BattleNode.Lifecycle;
|
||||
|
||||
[TestFixture]
|
||||
public class ScriptedLifecycleTests
|
||||
{
|
||||
[Test]
|
||||
public void BuildMatched_PutsOppoIdInSelfInfoEqualToTheRealOpponentVid()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildMatched(playerViewerId: 906243102, opponentViewerId: 847666884, battleId: "b");
|
||||
|
||||
Assert.That(env.Uri, Is.EqualTo(NetworkBattleUri.Matched));
|
||||
var selfInfo = (Dictionary<string, object?>)env.Body["selfInfo"]!;
|
||||
Assert.That(selfInfo["oppoId"], Is.EqualTo(847666884L));
|
||||
var oppoInfo = (Dictionary<string, object?>)env.Body["oppoInfo"]!;
|
||||
Assert.That(oppoInfo["oppoId"], Is.EqualTo(906243102L));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildMatched_ContainsThirtyCardSelfDeck()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildMatched(1, 2, "b");
|
||||
var deck = (List<object?>)env.Body["selfDeck"]!;
|
||||
Assert.That(deck.Count, Is.EqualTo(30));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildBattleStart_HasTurnStateZeroAndBattleTypeEleven()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildBattleStart(playerViewerId: 1);
|
||||
Assert.That(env.Body["turnState"], Is.EqualTo(0));
|
||||
Assert.That(env.Body["battleType"], Is.EqualTo(11));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildDeal_HasThreeSelfAndThreeOppoEntries()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildDeal();
|
||||
var self = (List<object?>)env.Body["self"]!;
|
||||
var oppo = (List<object?>)env.Body["oppo"]!;
|
||||
Assert.That(self.Count, Is.EqualTo(3));
|
||||
Assert.That(oppo.Count, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildSwapResponse_EchoesSameHandIfNoSwap()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildSwapResponse(swapIndices: Array.Empty<long>());
|
||||
var self = (List<object?>)env.Body["self"]!;
|
||||
Assert.That(self.Count, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildReady_IncludesIdxChangeSeedAndSpin()
|
||||
{
|
||||
var env = ScriptedLifecycle.BuildReady();
|
||||
Assert.That(env.Body.ContainsKey("idxChangeSeed"), Is.True);
|
||||
Assert.That(env.Body.ContainsKey("spin"), Is.True);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user