Many more tests and fixes
All checks were successful
Build / Build (push) Successful in 3m12s

This commit is contained in:
2026-08-27 17:11:12 +02:00
parent 32b3ef9c4a
commit d2a82b5fe3
204 changed files with 20255 additions and 242 deletions

View File

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