Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -26,16 +26,14 @@ public class IonDelugeTests
|
||||
// Arrange
|
||||
var script = new IonDeluge();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
move.User.Returns(user);
|
||||
var battle = Substitute.For<IBattle>();
|
||||
battle.GetScripts().Returns(_ => new ScriptIterator(new List<IEnumerable<ScriptContainer>>()));
|
||||
var battleVolatile = new ScriptSet(battle);
|
||||
battle.Volatile.Returns(battleVolatile);
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
user.BattleData.Returns(battleData);
|
||||
var target = Substitute.For<IPokemon>();
|
||||
user.Battle.Returns(battle);
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
@@ -44,27 +42,6 @@ public class IonDelugeTests
|
||||
await Assert.That(battleVolatile.Get<IonDelugeEffect>()).IsNotNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Technical test: if the user has no <see cref="IPokemon.BattleData"/>, the script does nothing and
|
||||
/// does not throw.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task OnSecondaryEffect_UserHasNoBattleData_DoesNothing()
|
||||
{
|
||||
// Arrange
|
||||
var script = new IonDeluge();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.BattleData.Returns((IPokemonBattleData?)null);
|
||||
move.User.Returns(user);
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, Substitute.For<IPokemon>(), 0);
|
||||
|
||||
// Assert - nothing thrown, nothing to observe
|
||||
await Assert.That(user.BattleData).IsNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bulbapedia: "Ion Deluge causes all Normal-type moves to become Electric-type instead, including
|
||||
/// status moves."
|
||||
@@ -75,7 +52,7 @@ public class IonDelugeTests
|
||||
// Arrange
|
||||
var effect = new IonDelugeEffect();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
var library = LibraryHelpers.LoadLibrary();
|
||||
target.Library.Returns(library);
|
||||
var types = library.StaticLibrary.Types;
|
||||
@@ -100,7 +77,7 @@ public class IonDelugeTests
|
||||
// Arrange
|
||||
var effect = new IonDelugeEffect();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
var library = LibraryHelpers.LoadLibrary();
|
||||
target.Library.Returns(library);
|
||||
var types = library.StaticLibrary.Types;
|
||||
@@ -124,7 +101,7 @@ public class IonDelugeTests
|
||||
// Arrange
|
||||
var effect = new IonDelugeEffect();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
TypeIdentifier? moveType = null;
|
||||
|
||||
// Act
|
||||
|
||||
Reference in New Issue
Block a user