37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
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");
|
|
Season a0 = new("a0");
|
|
Unit u1 = Unit.Build(Mun.Key, a0, "Austria", UnitType.Army);
|
|
|
|
world = world.WithNewSeason(a0, out Season a1);
|
|
Unit u2 = u1.Next(Boh.Key, a1);
|
|
|
|
_ = world.WithNewSeason(a1, out Season a2);
|
|
Unit u3 = u2.Next(Tyr.Key, a2);
|
|
|
|
Assert.That(u3.Past, Is.EqualTo(u2.Key), "Missing unit past");
|
|
Assert.That(u2.Past, Is.EqualTo(u1.Key), "Missing unit past");
|
|
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");
|
|
|
|
Assert.That(u1.Location, Is.EqualTo(Mun.Key), "Unexpected unit location");
|
|
Assert.That(u2.Location, Is.EqualTo(Boh.Key), "Unexpected unit location");
|
|
Assert.That(u3.Location, Is.EqualTo(Tyr.Key), "Unexpected unit location");
|
|
}
|
|
} |