[Fix] Reorder the enum to the correct order (#15540)

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
This commit is contained in:
TJ Lambert 2022-07-26 10:40:12 -05:00 коммит произвёл GitHub
Родитель af0b059176
Коммит 481e3ec53a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 53 добавлений и 2 удалений

Просмотреть файл

@ -171,10 +171,29 @@ namespace UserNotifications {
[Native]
public enum UNNotificationInterruptionLevel : long
{
Active,
Critical,
#if XAMCORE_5_0
Passive,
Active,
TimeSensitive,
Critical,
#else
[Obsolete ("Use 'Active2'.")]
Active,
[Obsolete ("Use 'Critical2'.")]
Critical,
[Obsolete ("Use 'Passive2'.")]
Passive,
[Obsolete ("Use 'TimeSensitive2'.")]
TimeSensitive,
#endif // XAMCORE_5_0
// Additional enum values to fix reordering - to be at the end of the enum
#if !XAMCORE_5_0
Active2 = Critical,
Critical2 = TimeSensitive,
Passive2 = Active,
TimeSensitive2 = Passive,
#endif // !XAMCORE_5_0
}
[iOS (10, 0)]

Просмотреть файл

@ -0,0 +1,32 @@
using System;
using NUnit.Framework;
using Foundation;
using UserNotifications;
namespace MonoTouchFixtures.UserNotifications {
[TestFixture]
[Preserve (AllMembers = true)]
public class UNNotificationInterruptionLevelTest {
[Test]
public void EnumTest ()
{
#if !XAMCORE_5_0
/* Apple Docs order these enum values as:
typedef NS_ENUM (NSUInteger, UNNotificationInterruptionLevel)
{
UNNotificationInterruptionLevelPassive,
UNNotificationInterruptionLevelActive,
UNNotificationInterruptionLevelTimeSensitive,
UNNotificationInterruptionLevelCritical,
} */
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Passive2, 0);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Active2, 1);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.TimeSensitive2, 2);
Assert.AreEqual ( (int)UNNotificationInterruptionLevel.Critical2, 3);
#endif
}
}
}