PKHeX/Tests/PKHeX.Tests/Simulator/ShowdownSetTests.cs
Kurt 76b4db1477 Add egg converter & test
only tested for gen7 egg->pkm (not to eventual set)

pretty sure a good chunk of the egg generation logic can be pulled out
for reuse in other IEncounterable generators (IEncounterable
extensions?)
2018-03-28 20:40:07 -07:00

56 lines
1.6 KiB
C#

using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PKHeX.Core;
namespace PKHeX.Tests.Simulator
{
[TestClass]
public class ShowdownSetTests
{
private const string SimulatorParse = "Set Parsing Tests";
[TestMethod]
[TestCategory(SimulatorParse)]
public void SimulatorGetParse()
{
var set = new ShowdownSet(SetGlaceonUSUMTutor);
Assert.AreEqual(SetGlaceonUSUMTutor, set.Text);
}
[TestMethod]
[TestCategory(SimulatorParse)]
public void SimulatorGetEncounters()
{
var set = new ShowdownSet(SetGlaceonUSUMTutor);
var pk7 = new PK7 {Species = set.Species, AltForm = set.FormIndex, Moves = set.Moves};
var encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves, GameVersion.MN);
Assert.IsTrue(!encs.Any());
pk7.HT_Name = "PKHeX";
encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves, GameVersion.MN);
var first = encs.FirstOrDefault();
Assert.IsTrue(first != null);
var egg = (EncounterEgg)first;
var info = new SimpleTrainerInfo();
var pk = egg.ConvertToPKM(info);
Assert.IsTrue(pk.Species != set.Species);
var la = new LegalityAnalysis(pk);
Assert.IsTrue(la.Valid);
}
private const string SetGlaceonUSUMTutor =
@"Glaceon (F) @ Assault Vest
IVs: 0 Atk
EVs: 252 HP / 252 SpA / 4 SpD
Ability: Ice Body
Level: 100
Shiny: Yes
Modest Nature
- Blizzard
- Water Pulse
- Shadow Ball
- Hyper Voice";
}
}