Make TestCaseBuilder reusable

This commit is contained in:
Jaculabilis 2022-03-29 20:49:33 -07:00
parent 6948db29df
commit b347cc88aa
3 changed files with 4 additions and 3 deletions

View File

@ -212,7 +212,6 @@ public class MovementAdjudicatorTest
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
Assert.That(u2.Season, Is.EqualTo(s2));
setup = new(updated);
setup[(1, 0)]
["Germany"]
.Army("Mun").Holds().GetReference(out var mun2);
@ -263,7 +262,6 @@ public class MovementAdjudicatorTest
Assert.That(u2.Past, Is.EqualTo(mun1.Order.Unit));
Assert.That(u2.Season, Is.EqualTo(s2));
setup = new(updated);
setup[(1, 0)]
["Germany"]
.Army("Tyr").MovesTo("Mun").GetReference(out var tyr2);

View File

@ -258,6 +258,7 @@ public class TestCaseBuilder
public List<OrderValidation> ValidateOrders(IPhaseAdjudicator adjudicator)
{
this.ValidationResults = adjudicator.ValidateOrders(this.World, this.Orders.ToList());
this.OrderList.Clear();
return this.ValidationResults;
}
@ -273,6 +274,7 @@ public class TestCaseBuilder
.Select(validation => validation.Order)
.ToList();
this.AdjudicationResults = adjudicator.AdjudicateOrders(this.World, orders);
this.ValidationResults = null;
return this.AdjudicationResults;
}
@ -284,6 +286,7 @@ public class TestCaseBuilder
}
this.World = adjudicator.UpdateWorld(this.World, this.AdjudicationResults);
this.AdjudicationResults = null;
return this.World;
}

View File

@ -21,7 +21,7 @@ public class TimeTravelTest
setup.ValidateOrders(MovementPhaseAdjudicator.Instance);
setup.AdjudicateOrders(MovementPhaseAdjudicator.Instance);
setup = new(setup.UpdateWorld(MovementPhaseAdjudicator.Instance));
setup.UpdateWorld(MovementPhaseAdjudicator.Instance);
// Move into the past of the same timeline.
setup[(1, 0)]