Add Timelines.All shortcut
This commit is contained in:
parent
868138b988
commit
973f8ea0d7
|
@ -66,11 +66,17 @@ public class Timelines(int next, Dictionary<string, Season?> pasts)
|
|||
public int Next { get; private set; } = next;
|
||||
|
||||
/// <summary>
|
||||
/// Map of season designations to their parent seasons.
|
||||
/// The set of keys here is the set of all seasons in the multiverse.
|
||||
/// Map of season designations to their parent seasons. Every season has an entry, so
|
||||
/// the set of keys is the set of existing seasons.
|
||||
/// </summary>
|
||||
public Dictionary<string, Season?> Pasts { get; } = pasts;
|
||||
|
||||
/// <summary>
|
||||
/// All seasons in the multiverse.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IEnumerable<Season> Seasons => Pasts.Keys.Select(key => new Season(key));
|
||||
|
||||
/// <summary>
|
||||
/// Create a new multiverse with an initial season.
|
||||
/// </summary>
|
||||
|
|
|
@ -33,11 +33,11 @@ public class TimeTravelTest
|
|||
|
||||
// Confirm that there are now four seasons: three in the main timeline and one in a fork.
|
||||
Assert.That(
|
||||
world.Timelines.Pasts.Keys.Select(key => new Season(key)).Where(s => s.Timeline == s0.Timeline).Count(),
|
||||
world.Timelines.Seasons.Where(s => s.Timeline == s0.Timeline).Count(),
|
||||
Is.EqualTo(3),
|
||||
"Failed to advance main timeline after last unit left");
|
||||
Assert.That(
|
||||
world.Timelines.Pasts.Keys.Select(key => new Season(key)).Where(s => s.Timeline != s0.Timeline).Count(),
|
||||
world.Timelines.Seasons.Where(s => s.Timeline != s0.Timeline).Count(),
|
||||
Is.EqualTo(1),
|
||||
"Failed to fork timeline when unit moved in");
|
||||
|
||||
|
|
Loading…
Reference in New Issue