Add standard repl helper

This commit is contained in:
Tim Van Baak 2024-08-28 15:09:57 +00:00
parent d2a46aa02d
commit 720ccc4329
1 changed files with 14 additions and 11 deletions

View File

@ -8,11 +8,13 @@ namespace MultiversalDiplomacyTests;
public class ReplTest
{
private static ReplDriver StandardRepl() => new(
new SetupScriptHandler(World.WithStandardMap(), strict: true));
[Test]
public void SetupHandler()
{
SetupScriptHandler setup = new(World.WithStandardMap(), strict: true);
ReplDriver repl = new(setup);
var repl = StandardRepl();
repl["""
unit Germany A Munich
@ -37,15 +39,13 @@ public class ReplTest
[Test]
public void SubmitOrders()
{
SetupScriptHandler setup = new(World.WithStandardMap(), strict: true);
ReplDriver repl = new ReplDriver(setup)["""
var repl = StandardRepl();
repl["""
unit Germany A Mun
unit Austria A Tyr
unit England F Lon
begin
"""];
repl["""
---
Germany A Mun hold
Austria: Army Tyrolia - Vienna
England:
@ -75,12 +75,15 @@ public class ReplTest
[Test]
public void AssertBasic()
{
var repl = new ReplDriver(new SetupScriptHandler(World.WithStandardMap(), strict: true))["""
var repl = StandardRepl();
repl["""
unit Germany A Munich
---
---
"""];
repl["assert true"].AssertReady();
assert true
"""].AssertReady();
repl["assert false"].AssertClosed();
}
}