private async Task SendNotificationAsync_SendAdmNativeNotification_GetSuccessfulResultBack() { LoadMockData(); var notification = new AdmNotification("{\"data\":{\"key1\":\"value1\"}}"); var notificationResult = await _hubClient.SendNotificationAsync(notification, "someRandomTag1 && someRandomTag2"); Assert.Equal(NotificationOutcomeState.Enqueued, notificationResult.State); RecordTestResults(); }
public void AmazonAdm_Simple_Test() { var wait = new ManualResetEvent(false); var settings = new AdmPushChannelSettings("client_id", "client_secret"); var adm = new AdmPushChannel(settings); var n = new AdmNotification(); n.Data.Add("Test", "value"); n.RegistrationId = "12345"; adm.SendNotification(n, (sender, response) => wait.Set()); wait.WaitOne(); }
public static AdmNotification WithData(this AdmNotification n, string key, string value) { if (n.Data == null) { n.Data = new Dictionary <string, string>(); } if (!n.Data.ContainsKey(key)) { n.Data.Add(key, value); } else { n.Data[key] = value; } return(n); }
public static AdmNotification WithData(this AdmNotification n, IDictionary <string, string> data) { if (n.Data == null) { n.Data = new Dictionary <string, string>(); } foreach (var item in data) { if (!n.Data.ContainsKey(item.Key)) { n.Data.Add(item.Key, item.Value); } else { n.Data[item.Key] = item.Value; } } return(n); }
internal static Notification BuildNotificationFromString(string notificationAsString, NotificationPlatform platform) { Notification notification = null; if (platform == 0) { JObject jobj = JObject.Parse(notificationAsString); Dictionary <string, string> templateProperties = jobj.ToObject <Dictionary <string, string> >(); notification = new TemplateNotification(templateProperties); } else { switch (platform) { case NotificationPlatform.Wns: notification = new WindowsNotification(notificationAsString); break; case NotificationPlatform.Apns: notification = new AppleNotification(notificationAsString); break; case NotificationPlatform.Gcm: notification = new GcmNotification(notificationAsString); break; case NotificationPlatform.Adm: notification = new AdmNotification(notificationAsString); break; case NotificationPlatform.Mpns: notification = new MpnsNotification(notificationAsString); break; } } return(notification); }
internal static Notification BuildNotificationFromString(string notificationAsString, NotificationPlatform platform) { Notification notification = null; if (platform == 0) { return(BuildTemplateNotificationFromJsonString(notificationAsString)); } else { switch (platform) { case NotificationPlatform.Wns: notification = new WindowsNotification(notificationAsString); break; case NotificationPlatform.Apns: notification = new AppleNotification(notificationAsString); break; case NotificationPlatform.Gcm: notification = new GcmNotification(notificationAsString); break; case NotificationPlatform.Adm: notification = new AdmNotification(notificationAsString); break; case NotificationPlatform.Mpns: notification = new MpnsNotification(notificationAsString); break; } } return(notification); }
public static AdmNotification WithExpiresAfter(this AdmNotification n, int expiresAfterSeconds) { n.ExpiresAfter = expiresAfterSeconds; return(n); }
public static AdmNotification WithConsolidationKey(this AdmNotification n, string consolidationKey) { n.ConsolidationKey = consolidationKey; return(n); }
public static AdmNotification ForRegistrationId(this AdmNotification n, string registrationId) { n.RegistrationId = registrationId; return(n); }