@@ -39,6 +39,47 @@ public void CreateNotificationChannel_NotificationChannelIsCreated()
39
39
Assert . AreEqual ( currentChannelCount , AndroidNotificationCenter . GetNotificationChannels ( ) . Length ) ;
40
40
}
41
41
42
+ [ Test ]
43
+ [ UnityPlatform ( RuntimePlatform . Android ) ]
44
+ public void GetNotificationChannel_ReturnsTheChannel ( )
45
+ {
46
+ var channel = AndroidNotificationCenter . GetNotificationChannel ( kChannelId ) ;
47
+ Assert . IsNotNull ( channel ) ;
48
+ Assert . AreEqual ( "SerializeDeserializeNotification channel" , channel . Name ) ;
49
+ Assert . AreEqual ( "SerializeDeserializeNotification channel" , channel . Description ) ;
50
+ Assert . AreEqual ( Importance . High , channel . Importance ) ;
51
+ }
52
+
53
+ [ Test ]
54
+ [ UnityPlatform ( RuntimePlatform . Android ) ]
55
+ public void GetNotificationChannel_NonExistentChannel_ReturnsNull ( )
56
+ {
57
+ var channel = AndroidNotificationCenter . GetNotificationChannel ( "DoesNotExist" ) ;
58
+ Assert . IsNotNull ( channel ) ;
59
+ }
60
+
61
+ [ Test ]
62
+ [ UnityPlatform ( RuntimePlatform . Android ) ]
63
+ public void GetNotificationChannels_NoChannels_ReturnsEmptyArray ( )
64
+ {
65
+ var channels = AndroidNotificationCenter . GetNotificationChannels ( ) ;
66
+ foreach ( var channel in channels )
67
+ AndroidNotificationCenter . DeleteNotificationChannel ( channel . Id ) ;
68
+
69
+ try
70
+ {
71
+ var chans = AndroidNotificationCenter . GetNotificationChannels ( ) ;
72
+ Assert . IsNotNull ( chans ) ;
73
+ Assert . AreEqual ( 0 , chans . Length ) ;
74
+ }
75
+ finally
76
+ {
77
+ // recreate test channels to not break other tests
78
+ foreach ( var channel in channels )
79
+ AndroidNotificationCenter . RegisterNotificationChannel ( channel ) ;
80
+ }
81
+ }
82
+
42
83
[ Test ]
43
84
[ UnityPlatform ( RuntimePlatform . Android ) ]
44
85
public void DeleteNotificationChannel_NotificationChannelIsDeleted ( )
0 commit comments