Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/ElectricTerrainTests.cs

46 lines
1.6 KiB
C#

using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Plugin.Gen7.Scripts.Moves;
using ElectricTerrainScript = PkmnLib.Plugin.Gen7.Scripts.Terrain.ElectricTerrain;
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
/// <summary>
/// Tests for the <see cref="ElectricTerrain"/> move script.
/// Gen VII Bulbapedia behavior (Generations VI to VII): Electric Terrain "envelops the field and replaces
/// the background environment and any other terrain that is already in effect."
/// </summary>
public class ElectricTerrainTests
{
private static (ElectricTerrain script, IExecutingMove move, IBattle battle) CreateTestSetup()
{
var script = new ElectricTerrain();
var move = Substitute.For<IExecutingMove>();
var battle = Substitute.For<IBattle>();
var user = Substitute.For<IBattlePokemon>();
move.User.Returns(user);
user.Battle.Returns(battle);
return (script, move, battle);
}
/// <summary>
/// Bulbapedia: Electric Terrain "envelops the field and replaces the background environment and any
/// other terrain that is already in effect" — the move sets the battle's terrain to the
/// <see cref="ElectricTerrainScript"/> terrain script.
/// </summary>
[Test]
public void OnSecondaryEffect_SetsElectricTerrainOnBattle()
{
// Arrange
var (script, move, battle) = CreateTestSetup();
// Act
script.OnSecondaryEffect(move, Substitute.For<IBattlePokemon>(), 0);
// Assert
battle.Received(1).SetTerrain(ScriptUtils.ResolveName<ElectricTerrainScript>());
}
}