System.Globalization.Tests.DateTimeFormatInfoMiscTests.NativeCalendarNameTest C# (CSharp) Method

NativeCalendarNameTest() private method

private NativeCalendarNameTest ( DateTimeFormatInfo dtfi, Calendar calendar, string nativeCalendarName ) : void
dtfi DateTimeFormatInfo
calendar Calendar
nativeCalendarName string
return void
        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");
                }
            }
        }