@@ -2642,13 +2642,33 @@ public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string iana
26422642 }
26432643
26442644 public static bool SupportIanaNamesConversion => PlatformDetection . IsNotBrowser && PlatformDetection . ICUVersion . Major >= 52 ;
2645+ public static bool SupportIanaNamesConversionAndRemoteExecution => SupportIanaNamesConversion && RemoteExecutor . IsSupported ;
2646+
2647+ // This test is executed using the remote execution because it needs to run before creating the time zone cache to ensure testing with that state.
2648+ // There are already other tests that test after creating the cache.
2649+ [ ConditionalFact ( nameof ( SupportIanaNamesConversionAndRemoteExecution ) ) ]
2650+ public static void IsIanaIdWithNotCacheTest ( )
2651+ {
2652+ RemoteExecutor . Invoke ( ( ) =>
2653+ {
2654+ Assert . Equal ( ! s_isWindows || TimeZoneInfo . Local . Id . Equals ( "Utc" , StringComparison . OrdinalIgnoreCase ) , TimeZoneInfo . Local . HasIanaId ) ;
2655+
2656+ TimeZoneInfo tzi = TimeZoneInfo . FindSystemTimeZoneById ( "W. Europe Standard Time" ) ;
2657+ Assert . False ( tzi . HasIanaId ) ;
2658+
2659+ tzi = TimeZoneInfo . FindSystemTimeZoneById ( "Europe/Berlin" ) ;
2660+ Assert . True ( tzi . HasIanaId ) ;
2661+ } ) . Dispose ( ) ;
2662+ }
26452663
26462664 [ ConditionalFact ( nameof ( SupportIanaNamesConversion ) ) ]
26472665 [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/52072" , TestPlatforms . iOS | TestPlatforms . tvOS | TestPlatforms . MacCatalyst ) ]
26482666 public static void IsIanaIdTest ( )
26492667 {
26502668 bool expected = ! s_isWindows ;
26512669
2670+ Assert . Equal ( ( expected || TimeZoneInfo . Local . Id . Equals ( "Utc" , StringComparison . OrdinalIgnoreCase ) ) , TimeZoneInfo . Local . HasIanaId ) ;
2671+
26522672 foreach ( TimeZoneInfo tzi in TimeZoneInfo . GetSystemTimeZones ( ) )
26532673 {
26542674 Assert . True ( ( expected || tzi . Id . Equals ( "Utc" , StringComparison . OrdinalIgnoreCase ) ) == tzi . HasIanaId , $ "`{ tzi . Id } ` has wrong IANA Id indicator") ;
0 commit comments