5dplomacy/MultiversalDiplomacyTests/ReplTest.cs

36 lines
982 B
C#

using NUnit.Framework;
using MultiversalDiplomacy.Model;
using MultiversalDiplomacy.Script;
namespace MultiversalDiplomacyTests;
public class ReplTest
{
[Test]
public void SetupHandler()
{
SetupScriptHandler setup = new(World.WithStandardMap(), strict: true);
ReplDriver repl = new(setup);
repl["""
unit Germany A Munich
unit Austria Army Tyrolia
unit England F Lon
"""].Ready();
Assert.That(repl.Handler, Is.TypeOf<SetupScriptHandler>());
SetupScriptHandler handler = (SetupScriptHandler)repl.Handler!;
Assert.That(handler.World.Units.Count, Is.EqualTo(3));
Assert.That(handler.World.GetUnitAt("Mun"), Is.Not.Null);
Assert.That(handler.World.GetUnitAt("Tyr"), Is.Not.Null);
Assert.That(handler.World.GetUnitAt("Lon"), Is.Not.Null);
repl["""
---
"""].Ready();
Assert.That(repl.Handler, Is.TypeOf<GameScriptHandler>());
}
}