2022-02-18 22:52:15 +00:00
|
|
|
using MultiversalDiplomacy.Adjudicate;
|
|
|
|
using MultiversalDiplomacy.Model;
|
|
|
|
using MultiversalDiplomacy.Orders;
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace MultiversalDiplomacyTests;
|
|
|
|
|
|
|
|
public class AdjudicatorTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void OrderValidationTest()
|
|
|
|
{
|
2022-03-13 07:15:26 +00:00
|
|
|
IPhaseAdjudicator rubberStamp = new TestAdjudicator((world, orders) =>
|
|
|
|
{
|
|
|
|
return orders.Select(o => o.Validate(ValidationReason.Valid)).ToList();
|
2022-02-18 22:52:15 +00:00
|
|
|
});
|
2022-03-15 22:43:06 +00:00
|
|
|
World world = World.WithStandardMap().WithInitialSeason();
|
|
|
|
Power power = world.GetPower("Austria");
|
2022-02-18 22:52:15 +00:00
|
|
|
|
|
|
|
Order order = new NullOrder(power);
|
|
|
|
List<Order> orders = new List<Order> { order };
|
2022-03-13 07:15:26 +00:00
|
|
|
IEnumerable<OrderValidation> results = rubberStamp.ValidateOrders(world, orders);
|
2022-02-18 22:52:15 +00:00
|
|
|
|
|
|
|
Assert.That(results.Count(), Is.EqualTo(1));
|
|
|
|
Assert.That(results.First().Order, Is.EqualTo(order));
|
|
|
|
Assert.That(results.First().Reason, Is.EqualTo(ValidationReason.Valid));
|
|
|
|
Assert.That(results.First().Valid, Is.True);
|
|
|
|
}
|
|
|
|
}
|