2022-02-18 20:13:23 +00:00
|
|
|
using MultiversalDiplomacy.Model;
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace MultiversalDiplomacyTests;
|
|
|
|
|
|
|
|
public class UnitTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void MovementTest()
|
|
|
|
{
|
2022-03-29 05:34:57 +00:00
|
|
|
World world = World.WithStandardMap();
|
2024-08-12 04:01:05 +00:00
|
|
|
Location Mun = world.Map.GetLand("Mun"),
|
|
|
|
Boh = world.Map.GetLand("Boh"),
|
|
|
|
Tyr = world.Map.GetLand("Tyr");
|
|
|
|
Power pw1 = world.Map.GetPower("Austria");
|
2024-08-12 20:56:06 +00:00
|
|
|
Season a0 = world.RootSeason;
|
|
|
|
Unit u1 = Unit.Build(Mun, a0, pw1, UnitType.Army);
|
2022-02-18 20:13:23 +00:00
|
|
|
|
2024-08-12 20:56:06 +00:00
|
|
|
world = world.ContinueSeason(a0);
|
|
|
|
Season a1 = world.GetSeason("a1");
|
|
|
|
Unit u2 = u1.Next(Boh, a1);
|
2022-02-18 20:13:23 +00:00
|
|
|
|
2024-08-12 20:56:06 +00:00
|
|
|
world = world.ContinueSeason(a1);
|
|
|
|
Season a2 = world.GetSeason("a2");
|
|
|
|
Unit u3 = u2.Next(Tyr, a2);
|
2022-02-18 20:13:23 +00:00
|
|
|
|
|
|
|
Assert.That(u3.Past, Is.EqualTo(u2), "Missing unit past");
|
|
|
|
Assert.That(u2.Past, Is.EqualTo(u1), "Missing unit past");
|
|
|
|
Assert.That(u1.Past, Is.Null, "Unexpected unit past");
|
|
|
|
|
2024-08-12 20:56:06 +00:00
|
|
|
Assert.That(u1.Season, Is.EqualTo(a0), "Unexpected unit season");
|
|
|
|
Assert.That(u2.Season, Is.EqualTo(a1), "Unexpected unit season");
|
|
|
|
Assert.That(u3.Season, Is.EqualTo(a2), "Unexpected unit season");
|
2022-02-18 20:13:23 +00:00
|
|
|
|
2022-03-13 07:15:26 +00:00
|
|
|
Assert.That(u1.Location, Is.EqualTo(Mun), "Unexpected unit location");
|
|
|
|
Assert.That(u2.Location, Is.EqualTo(Boh), "Unexpected unit location");
|
|
|
|
Assert.That(u3.Location, Is.EqualTo(Tyr), "Unexpected unit location");
|
2022-02-18 20:13:23 +00:00
|
|
|
}
|
|
|
|
}
|