using System; using AcDream.Core.World; using Xunit; namespace AcDream.Core.Tests.World; public sealed class WorldTimeDebugTests { [Fact] public void SetDebugTime_OverridesDayFraction() { var service = new WorldTimeService(SkyStateProvider.Default()); service.SyncFromServer(0); // midnight service.SetDebugTime(0.5f); // force noon Assert.InRange(service.DayFraction, 0.499, 0.501); } [Fact] public void ClearDebugTime_RestoresServerTime() { var service = new WorldTimeService(SkyStateProvider.Default()); service.SyncFromServer(DerethDateTime.DayTicks * 0.25); // dawn service.SetDebugTime(0.5f); service.ClearDebugTime(); Assert.InRange(service.DayFraction, 0.24, 0.26); } [Fact] public void SyncFromServer_ClearsDebugOverride() { var service = new WorldTimeService(SkyStateProvider.Default()); service.SetDebugTime(0.75f); service.SyncFromServer(0); // midnight — this should clear the override Assert.InRange(service.DayFraction, 0.0, 0.01); } [Fact] public void SetProvider_AcceptsNewKeyframes() { var service = new WorldTimeService(SkyStateProvider.Default()); var custom = new SkyStateProvider(new[] { new SkyKeyframe( Begin: 0f, SunHeadingDeg: 0f, SunPitchDeg: 90f, SunColor: System.Numerics.Vector3.One, AmbientColor: System.Numerics.Vector3.One, FogColor: System.Numerics.Vector3.Zero, FogDensity: 0f), }); service.SetProvider(custom); Assert.Equal(1, custom.KeyframeCount); } }