Adds optional way to set damage randomness on or off on individual integration tests.
All checks were successful
Build / Build (push) Successful in 49s
All checks were successful
Build / Build (push) Successful in 49s
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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!;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user