This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for the <see cref="GastroAcid"/> move script.
|
||||
/// Gen VII Bulbapedia behavior: "Gastro Acid suppresses the target's Ability while it remains in battle."
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Bulbapedia also lists Abilities the move fails against (Multitype, Stance Change, ...); that check is
|
||||
/// implemented engine-side through <see cref="PkmnLib.Static.Species.IAbility.CanBeChanged"/> inside
|
||||
/// <see cref="IPokemon.SuppressAbility"/>, so it is not the responsibility of this script.
|
||||
/// </remarks>
|
||||
public class GastroAcidTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Bulbapedia: "Gastro Acid suppresses the target's Ability while it remains in battle."
|
||||
/// The script requests the suppression on the target.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task OnSecondaryEffect_Always_SuppressesTargetAbility()
|
||||
{
|
||||
// Arrange
|
||||
var script = new GastroAcid();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
target.Received(1).SuppressAbility();
|
||||
await Assert.That(target.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "SuppressAbility")).IsTrue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bulbapedia: the suppression applies to "the target's Ability" — the user's own Ability is left
|
||||
/// untouched.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task OnSecondaryEffect_Always_DoesNotSuppressUserAbility()
|
||||
{
|
||||
// Arrange
|
||||
var script = new GastroAcid();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
move.User.Returns(user);
|
||||
var target = Substitute.For<IPokemon>();
|
||||
|
||||
// Act
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(user.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "SuppressAbility")).IsFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user