Style cleanup

This commit is contained in:
2025-03-02 17:19:57 +01:00
parent c0bc905c46
commit 284ab3079c
175 changed files with 588 additions and 650 deletions

View File

@@ -26,8 +26,7 @@ public class IntegrationTestRunner
}
}
[Test]
[MethodDataSource(nameof(TestCases))]
[Test, MethodDataSource(nameof(TestCases))]
public async Task RunIntegrationTest(IntegrationTestModel test)
{
var library = LibraryHelpers.LoadLibrary();
@@ -40,11 +39,10 @@ public class IntegrationTestRunner
var pokemon = x.Pokemon[index];
await Assert.That(library.StaticLibrary.Species.TryGet(pokemon.Species, out var species)).IsTrue();
var mon = new PokemonImpl(library, species!, species!.GetDefaultForm(), new AbilityIndex
{
IsHidden = false,
Index = 0,
},
pokemon.Level, 0, Gender.Genderless, 0, "hardy");
{
IsHidden = false,
Index = 0,
}, pokemon.Level, 0, Gender.Genderless, 0, "hardy");
foreach (var move in pokemon.Moves)
{
mon.LearnMove(move, MoveLearnMethod.Unknown, 255);
@@ -56,7 +54,7 @@ public class IntegrationTestRunner
return new BattlePartyImpl(party, x.Indices.Select(y => new ResponsibleIndex(y[0], y[1])).ToArray());
}).ProcessOneAtATime().GetResultsAsync();
var battle = new BattleImpl(library, parties, test.BattleSetup.CanFlee, test.BattleSetup.NumberOfSides,
test.BattleSetup.PositionsPerSide, randomSeed: test.BattleSetup.Seed);
test.BattleSetup.PositionsPerSide, test.BattleSetup.Seed);
foreach (var action in test.Actions)
{

View File

@@ -37,5 +37,5 @@ public static class LibraryHelpers
}),
]);
return dynamicLibrary;
}
}
}

View File

@@ -7,11 +7,8 @@ using JsonSerializer = System.Text.Json.JsonSerializer;
namespace PkmnLib.Tests.Integration.Models;
[JsonDerivedType(typeof(SetPokemonAction), "setPokemon")]
[JsonDerivedType(typeof(SetMoveChoiceAction), "setMoveChoice")]
[JsonDerivedType(typeof(SetPassChoiceAction), "setPassChoice")]
[JsonDerivedType(typeof(AssertAction), "assert")]
[JsonDerivedType(typeof(SetPokemonAction), "setPokemon"), JsonDerivedType(typeof(SetMoveChoiceAction), "setMoveChoice"),
JsonDerivedType(typeof(SetPassChoiceAction), "setPassChoice"), JsonDerivedType(typeof(AssertAction), "assert")]
public abstract class IntegrationTestAction
{
public abstract Task Execute(IBattle battle);
@@ -36,7 +33,6 @@ public class SetMoveChoiceAction : IntegrationTestAction
public string Move { get; set; } = null!;
public List<byte> Target { get; set; } = null!;
/// <inheritdoc />
public override async Task Execute(IBattle battle)
{
@@ -73,7 +69,7 @@ public class AssertAction : IntegrationTestAction
{
var list = battle.Path(Value).ToList();
var value = list.Count == 1 ? list[0] : list;
var serialized = JsonSerializer.Serialize(value);
await Assert.That(serialized).IsEqualTo(Expected.ToJsonString());
}

View File

@@ -8,10 +8,7 @@ public class IntegrationTestModel
public IntegrationTestAction[] Actions { get; set; } = null!;
/// <inheritdoc />
public override string ToString()
{
return Name;
}
public override string ToString() => Name;
}
public class IntegrationTestBattleSetup