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