5dplomacy/MultiversalDiplomacyTests/ReplTest.cs

36 lines
982 B
C#
Raw Normal View History

2024-08-27 04:18:36 +00:00
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
2024-08-28 00:45:38 +00:00
unit England F Lon
2024-08-27 04:18:36 +00:00
"""].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>());
}
}