Enhance world simulation and API functionality; implement clock management improvements, ensure proper handling of world states during updates, and refine data persistence methods to prevent resurrecting deleted worlds.
This commit is contained in:
@@ -80,6 +80,25 @@ public sealed class WorldSimulationTests
|
||||
GameTime.DefaultStart.AddMinutes(17));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Catch_up_skips_a_world_that_was_paused_when_the_host_went_down()
|
||||
{
|
||||
var summary = ReadySummary() with
|
||||
{
|
||||
Clock = WorldSimulation.DefaultClock() with { Paused = true },
|
||||
LastTickedAt = DateTimeOffset.UtcNow - TimeSpan.FromHours(6),
|
||||
};
|
||||
|
||||
using var simulation = WorldSimulation.Create(summary, catchUp: true);
|
||||
|
||||
Assert.Equal(GameTime.DefaultStart, simulation.SnapshotClock().GameTime);
|
||||
|
||||
// Unpausing must not replay the six hours spent paused offline either.
|
||||
var resumed = simulation.Update(new UpdateClockRequest { Paused = false });
|
||||
Assert.False(resumed.Paused);
|
||||
Assert.InRange(resumed.GameTime, GameTime.DefaultStart, GameTime.DefaultStart.AddMinutes(5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OverlayForApi_strips_last_ticked_at()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user