using MeterVault.Infrastructure.Options; namespace MeterVault.Integration.Tests; /// /// The configured zone id reaches .NET and PostgreSQL alike. Pure, so no Docker. /// public sealed class InstanceTimeZoneTests { [Fact] public void A_windows_zone_id_is_turned_into_the_iana_id_postgres_understands() { if (!TimeZoneInfo.TryFindSystemTimeZoneById("W. Europe Standard Time", out _)) { return; // No Windows-id support on this host (no ICU): nothing to translate. } Assert.Equal("Europe/Berlin", InstanceTimeZone.Canonical("W. Europe Standard Time")); } [Theory] [InlineData("Europe/Berlin")] [InlineData("America/New_York")] [InlineData("Not/AZone")] public void Iana_and_unknown_ids_are_left_as_they_are(string id) => Assert.Equal(id, InstanceTimeZone.Canonical(id)); [Fact] public void A_local_date_starts_at_its_local_midnight() { var berlin = InstanceTimeZone.Resolve("Europe/Berlin"); Assert.Equal(new DateTimeOffset(2026, 7, 31, 22, 0, 0, TimeSpan.Zero), InstanceTimeZone.StartOf(new DateOnly(2026, 8, 1), berlin)); Assert.Equal(TimeZoneInfo.Utc, InstanceTimeZone.Resolve("Not/AZone")); } }