Enable fluent definitions of multiple turns
This commit is contained in:
parent
b347cc88aa
commit
604dda95e8
@ -167,6 +167,11 @@ public class TestCaseBuilder
|
||||
/// </summary>
|
||||
public interface IOrderDefinedContext<OrderType> where OrderType : Order
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform validation, adjudication, and update using the defined orders.
|
||||
/// </summary>
|
||||
public TestCaseBuilder Execute(IPhaseAdjudicator adjudicator);
|
||||
|
||||
/// <summary>
|
||||
/// Choose a new season to define orders for.
|
||||
/// </summary>
|
||||
@ -579,6 +584,14 @@ public class TestCaseBuilder
|
||||
this.Order = order;
|
||||
}
|
||||
|
||||
public TestCaseBuilder Execute(IPhaseAdjudicator adjudicator)
|
||||
{
|
||||
this.Builder.ValidateOrders(adjudicator);
|
||||
this.Builder.AdjudicateOrders(adjudicator);
|
||||
this.Builder.UpdateWorld(adjudicator);
|
||||
return this.Builder;
|
||||
}
|
||||
|
||||
public ISeasonContext this[(int turn, int timeline) seasonCoord]
|
||||
=> this.SeasonContext[seasonCoord];
|
||||
|
||||
|
@ -13,18 +13,13 @@ public class TimeTravelTest
|
||||
{
|
||||
TestCaseBuilder setup = new(World.WithStandardMap());
|
||||
|
||||
// Hold once so the timeline has a past.
|
||||
// Hold to move into the future, then move back into the past.
|
||||
setup[(0, 0)]
|
||||
.GetReference(out Season s0)
|
||||
["Germany"]
|
||||
.Army("Mun").Holds().GetReference(out var mun0);
|
||||
|
||||
setup.ValidateOrders(MovementPhaseAdjudicator.Instance);
|
||||
setup.AdjudicateOrders(MovementPhaseAdjudicator.Instance);
|
||||
setup.UpdateWorld(MovementPhaseAdjudicator.Instance);
|
||||
|
||||
// Move into the past of the same timeline.
|
||||
setup[(1, 0)]
|
||||
.Army("Mun").Holds().GetReference(out var mun0)
|
||||
.Execute(MovementPhaseAdjudicator.Instance)
|
||||
[(1, 0)]
|
||||
.GetReference(out Season s1)
|
||||
["Germany"]
|
||||
.Army("Mun").MovesTo("Tyr", season: s0).GetReference(out var mun1);
|
||||
|
Loading…
Reference in New Issue
Block a user