Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -15,19 +15,17 @@ public class FirstImpressionTests
|
||||
/// Creates a fully mocked test setup for First Impression tests, with the user having switched in on
|
||||
/// <paramref name="switchInTurn"/> while the battle is on <paramref name="currentTurn"/>.
|
||||
/// </summary>
|
||||
private static (FirstImpression script, IExecutingMove move, IPokemon user) CreateTestSetup(uint switchInTurn,
|
||||
private static (FirstImpression script, IExecutingMove move, IBattlePokemon user) CreateTestSetup(uint switchInTurn,
|
||||
uint currentTurn)
|
||||
{
|
||||
var script = new FirstImpression();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
|
||||
var battle = Substitute.For<IBattle>();
|
||||
battle.CurrentTurnNumber.Returns(currentTurn);
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
battleData.SwitchInTurn.Returns(switchInTurn);
|
||||
user.BattleData.Returns(battleData);
|
||||
user.Battle.Returns(battle);
|
||||
user.SwitchInTurn.Returns(switchInTurn);
|
||||
move.User.Returns(user);
|
||||
|
||||
return (script, move, user);
|
||||
@@ -88,26 +86,4 @@ public class FirstImpressionTests
|
||||
// Assert
|
||||
await Assert.That(stop).IsEqualTo(expectedStop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Technical test: if the user has no <see cref="IPokemon.BattleData"/>, the script cannot determine the
|
||||
/// switch-in turn and leaves the move untouched.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task StopBeforeMove_NoBattleData_MoveIsNotStopped()
|
||||
{
|
||||
// Arrange
|
||||
var script = new FirstImpression();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.BattleData.Returns((IPokemonBattleData?)null);
|
||||
move.User.Returns(user);
|
||||
var stop = false;
|
||||
|
||||
// Act
|
||||
script.StopBeforeMove(move, ref stop);
|
||||
|
||||
// Assert
|
||||
await Assert.That(stop).IsFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user