Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -17,11 +17,10 @@ public class CopycatTests
|
||||
private static (Copycat script, IMoveChoice choice) CreateTestSetup(string? lastMoveName)
|
||||
{
|
||||
var script = new Copycat();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
if (lastMoveName == null)
|
||||
{
|
||||
battleData.LastMoveChoice.Returns((IMoveChoice?)null);
|
||||
user.LastMoveChoice.Returns((IMoveChoice?)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -31,9 +30,8 @@ public class CopycatTests
|
||||
learnedMove.MoveData.Returns(moveData);
|
||||
var lastChoice = Substitute.For<IMoveChoice>();
|
||||
lastChoice.ChosenMove.Returns(learnedMove);
|
||||
battleData.LastMoveChoice.Returns(lastChoice);
|
||||
user.LastMoveChoice.Returns(lastChoice);
|
||||
}
|
||||
user.BattleData.Returns(battleData);
|
||||
|
||||
var choice = Substitute.For<IMoveChoice>();
|
||||
choice.User.Returns(user);
|
||||
@@ -94,25 +92,4 @@ public class CopycatTests
|
||||
choice.Received(1).Fail();
|
||||
await Assert.That(moveName).IsEqualTo(new StringKey("copycat"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Technical test: outside of battle (no battle data) there is no last move, so Copycat fails.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ChangeMove_NoBattleData_Fails()
|
||||
{
|
||||
// Arrange
|
||||
var script = new Copycat();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.BattleData.Returns((IPokemonBattleData?)null);
|
||||
var choice = Substitute.For<IMoveChoice>();
|
||||
choice.User.Returns(user);
|
||||
StringKey moveName = "copycat";
|
||||
|
||||
// Act
|
||||
script.ChangeMove(choice, ref moveName);
|
||||
|
||||
// Assert
|
||||
choice.Received(1).Fail();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user