Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -15,12 +15,12 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||
/// </summary>
|
||||
public class GrudgeTests
|
||||
{
|
||||
private static (Grudge script, IExecutingMove move, IPokemon user, IScriptSet userVolatile) CreateTestSetup()
|
||||
private static (Grudge script, IExecutingMove move, IBattlePokemon user, IScriptSet userVolatile) CreateTestSetup()
|
||||
{
|
||||
var script = new Grudge();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
var userVolatile = Substitute.For<IScriptSet>();
|
||||
user.Volatile.Returns(userVolatile);
|
||||
move.User.Returns(user);
|
||||
@@ -39,7 +39,7 @@ public class GrudgeTests
|
||||
var (script, move, _, userVolatile) = CreateTestSetup();
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, Substitute.For<IPokemon>(), 0);
|
||||
script.OnSecondaryEffect(move, Substitute.For<IBattlePokemon>(), 0);
|
||||
|
||||
// Assert
|
||||
userVolatile.Received(1).StackOrAdd(new StringKey("grudge"), Arg.Any<Func<Script?>>());
|
||||
@@ -59,7 +59,7 @@ public class GrudgeTests
|
||||
user.Library.Returns(LibraryHelpers.LoadLibrary());
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, Substitute.For<IPokemon>(), 0);
|
||||
script.OnSecondaryEffect(move, Substitute.For<IBattlePokemon>(), 0);
|
||||
|
||||
// Assert
|
||||
var call = userVolatile.ReceivedCalls().First(c => c.GetMethodInfo().Name == "StackOrAdd");
|
||||
@@ -76,7 +76,7 @@ public class GrudgeTests
|
||||
{
|
||||
// Arrange
|
||||
var (script, move, _, _) = CreateTestSetup();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
var targetVolatile = Substitute.For<IScriptSet>();
|
||||
target.Volatile.Returns(targetVolatile);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user