public void NativeCalendarNameTest(DateTimeFormatInfo dtfi, Calendar calendar, string nativeCalendarName)
{
try
{
dtfi.Calendar = calendar;
Assert.Equal(nativeCalendarName, dtfi.NativeCalendarName);
}
catch
{
if (PlatformDetection.IsWindows)
{
// Persian calendar is recently supported as one of the optional calendars for fa-IR
Assert.True(calendar is PersianCalendar, "Exception can occur only with PersianCalendar");
}
else // !PlatformDetection.IsWindows
{
Assert.True(calendar is HijriCalendar || calendar is UmAlQuraCalendar || calendar is ThaiBuddhistCalendar ||
calendar is HebrewCalendar || calendar is KoreanCalendar, "failed to set the calendar on DTFI");
}
}
}