Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/GastroAcidTests.cs
Deukhoofd d2a82b5fe3
All checks were successful
Build / Build (push) Successful in 3m12s
Many more tests and fixes
2026-08-27 17:11:12 +02:00

57 lines
2.0 KiB
C#

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();
}
}