Skip to content

Commit

Permalink
[Libraries] Fix TimeZoneInfoTests IsIanaIdTest for iOS/MacCatalyst/tv…
Browse files Browse the repository at this point in the history
…OS (#58562)

* [Libraries] Fix TimeZoneInfoTests IsIanaIdTest for iOS/MacCatalyst/tvOS

* [Libraries] Fix IsIanaIdTest to assert throw for iOS/MacCatalyst/tvOS

* Readd new line

* [Mobile][Libraries] System.Runtime.Tests TimeZoneInfoTests remove mobile from iana conversion support

* [libraries] System.Runtime.Tests revert IsIanaIdTest iOS tvOS special casing

* Remove active issue added in recently merged PR

Co-authored-by: Mitchell Hwang <[email protected]>
  • Loading branch information
mdh1418 and Mitchell Hwang authored Sep 6, 2021
1 parent 791a0d8 commit db04259
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,7 @@ public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string iana
}
}

public static bool SupportIanaNamesConversion => PlatformDetection.IsNotBrowser && PlatformDetection.ICUVersion.Major >= 52;
public static bool SupportIanaNamesConversion => PlatformDetection.IsNotMobile && PlatformDetection.ICUVersion.Major >= 52;
public static bool SupportIanaNamesConversionAndRemoteExecution => SupportIanaNamesConversion && RemoteExecutor.IsSupported;

// 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.
Expand All @@ -2660,7 +2660,6 @@ public static void IsIanaIdWithNotCacheTest()
}

[ConditionalFact(nameof(SupportIanaNamesConversion))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58440", TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)]
public static void IsIanaIdTest()
{
bool expected = !s_isWindows;
Expand All @@ -2672,8 +2671,7 @@ public static void IsIanaIdTest()
Assert.True((expected || tzi.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)) == tzi.HasIanaId, $"`{tzi.Id}` has wrong IANA Id indicator");
}

string timeZoneIdNotIANAId = PlatformDetection.IsiOS || PlatformDetection.IstvOS ? "America/Buenos_Aires" : "Pacific Standard Time";
Assert.False(TimeZoneInfo.FindSystemTimeZoneById(timeZoneIdNotIANAId).HasIanaId, $" should not be IANA Id.");
Assert.False(TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time").HasIanaId, $" should not be IANA Id.");
Assert.True(TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles").HasIanaId, $"'America/Los_Angeles' should be IANA Id");
}

Expand All @@ -2693,7 +2691,6 @@ public static void IsIanaIdTest()
[InlineData("Argentina Standard Time", "America/Buenos_Aires")]
[InlineData("Newfoundland Standard Time", "America/St_Johns")]
[InlineData("Iran Standard Time", "Asia/Tehran")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS/MacCatalyst/tvOS.")]
public static void IdsConversionsTest(string windowsId, string ianaId)
{
Assert.True(TimeZoneInfo.TryConvertIanaIdToWindowsId(ianaId, out string winId));
Expand Down Expand Up @@ -2728,7 +2725,6 @@ public static void IdsConversionsTest(string windowsId, string ianaId)
[InlineData("GMT Standard Time", "Europe/Dublin", "ie")]
[InlineData("W. Europe Standard Time", "Europe/Rome", "it")]
[InlineData("New Zealand Standard Time", "Pacific/Auckland", "nz")]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS/MacCatalyst/tvOS.")]
public static void IdsConversionsWithRegionTest(string windowsId, string ianaId, string region)
{
Assert.True(TimeZoneInfo.TryConvertWindowsIdToIanaId(windowsId, region, out string ianaConvertedId));
Expand Down

0 comments on commit db04259

Please sign in to comment.