5dplomacy/MultiversalDiplomacyTests/UnitTests.cs

38 lines
1.4 KiB
C#
Raw Normal View History

2022-02-18 20:13:23 +00:00
using MultiversalDiplomacy.Model;
using NUnit.Framework;
namespace MultiversalDiplomacyTests;
public class UnitTests
{
[Test]
public void MovementTest()
{
World world = World.WithStandardMap();
Location Mun = world.Map.GetLand("Mun"),
Boh = world.Map.GetLand("Boh"),
Tyr = world.Map.GetLand("Tyr");
Power pw1 = world.Map.GetPower("Austria");
Season a0 = world.RootSeason;
2024-08-14 15:20:04 +00:00
Unit u1 = Unit.Build(Mun.Designation, a0, pw1, UnitType.Army);
2022-02-18 20:13:23 +00:00
world = world.ContinueOrFork(a0, out Season a1);
2024-08-14 15:20:04 +00:00
Unit u2 = u1.Next(Boh.Designation, a1);
2022-02-18 20:13:23 +00:00
_ = world.ContinueOrFork(a1, out Season a2);
2024-08-14 15:20:04 +00:00
Unit u3 = u2.Next(Tyr.Designation, a2);
2022-02-18 20:13:23 +00:00
2024-08-14 15:39:19 +00:00
Assert.That(u3.Past, Is.EqualTo(u2.Designation), "Missing unit past");
Assert.That(u2.Past, Is.EqualTo(u1.Designation), "Missing unit past");
2022-02-18 20:13:23 +00:00
Assert.That(u1.Past, Is.Null, "Unexpected unit past");
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
2024-08-14 15:20:04 +00:00
Assert.That(u1.Location, Is.EqualTo(Mun.Designation), "Unexpected unit location");
Assert.That(u2.Location, Is.EqualTo(Boh.Designation), "Unexpected unit location");
Assert.That(u3.Location, Is.EqualTo(Tyr.Designation), "Unexpected unit location");
2022-02-18 20:13:23 +00:00
}
}