Adds optional way to set damage randomness on or off on individual integration tests.
All checks were successful
Build / Build (push) Successful in 49s

This commit is contained in:
2025-05-19 16:10:05 +02:00
parent 405a21e887
commit 2680aeff80
6 changed files with 34 additions and 13 deletions

View File

@@ -31,15 +31,31 @@ public class IntegrationTestRunner
}
}
private static IDynamicLibrary? _libraryWithRandomness;
private static IDynamicLibrary? _libraryWithoutRandomness;
[Test, MethodDataSource(nameof(TestCases))]
public async Task RunIntegrationTest(IntegrationTestModel test)
{
var library = DynamicLibraryImpl.Create([
new Gen7Plugin(new Gen7PluginConfiguration
{
DamageCalculatorHasRandomness = true,
}),
]);
IDynamicLibrary library;
if (test.BattleSetup.HasDamageRandomness)
{
library = _libraryWithRandomness ??= DynamicLibraryImpl.Create([
new Gen7Plugin(new Gen7PluginConfiguration
{
DamageCalculatorHasRandomness = true,
}),
]);
}
else
{
library = _libraryWithoutRandomness ??= DynamicLibraryImpl.Create([
new Gen7Plugin(new Gen7PluginConfiguration
{
DamageCalculatorHasRandomness = false,
}),
]);
}
await TestContext.Current!.OutputWriter.WriteLineAsync("File: " + $"file://{test.FileName}");
TestContext.Current.AddArtifact(new Artifact

View File

@@ -18,6 +18,7 @@ public class IntegrationTestBattleSetup
public bool CanFlee { get; set; }
public byte NumberOfSides { get; set; }
public byte PositionsPerSide { get; set; }
public bool HasDamageRandomness { get; set; }
public IntegrationTestParty[] Parties { get; set; } = null!;
}

View File

@@ -6,6 +6,7 @@
"canFlee": false,
"numberOfSides": 2,
"positionsPerSide": 1,
"hasDamageRandomness": false,
"parties": [
{
"indices": [
@@ -93,7 +94,7 @@
{
"$type": "assert",
"value": ".Sides[1].Pokemon[0].CurrentHealth",
"expected": 84
"expected": 78
}
]
}