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.Past, Is.EqualTo(mun1.Order.Unit));
Assert.That(u2.Season, Is.EqualTo(s2)); Assert.That(u2.Season, Is.EqualTo(s2));
setup = new(updated);
setup[(1, 0)] setup[(1, 0)]
["Germany"] ["Germany"]
.Army("Mun").Holds().GetReference(out var mun2); .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.Past, Is.EqualTo(mun1.Order.Unit));
Assert.That(u2.Season, Is.EqualTo(s2)); Assert.That(u2.Season, Is.EqualTo(s2));
setup = new(updated);
setup[(1, 0)] setup[(1, 0)]
["Germany"] ["Germany"]
.Army("Tyr").MovesTo("Mun").GetReference(out var tyr2); .Army("Tyr").MovesTo("Mun").GetReference(out var tyr2);

View File

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

View File

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