5dplomacy/MultiversalDiplomacyTests/ScriptTests.cs

29 lines
868 B
C#
Raw Normal View History

2024-08-18 04:24:59 +00:00
using NUnit.Framework;
using MultiversalDiplomacy.Model;
using MultiversalDiplomacy.Script;
namespace MultiversalDiplomacyTests;
public class ScriptTests
{
static IEnumerable<TestCaseData> DatcTestCases()
{
foreach (var path in Directory.EnumerateFiles("Scripts/DATC"))
{
yield return new TestCaseData(path)
.SetName($"{{m}}({Path.GetFileNameWithoutExtension(path)})");
}
}
[TestCaseSource(nameof(DatcTestCases))]
public void Test_DATC(string testScriptPath)
{
IScriptHandler? handler = new SetupScriptHandler(World.WithStandardMap(), strict: true);
foreach (string input in File.ReadAllLines(testScriptPath)) {
handler = handler?.HandleInput(input);
Assert.That(handler, Is.Not.Null, $"Script quit unexpectedly at \"{input}\"");
}
}
}