public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var request = new PushNotificationRequest { DeviceTokens = new List<string> { "BadToken" }, Payload = new PushPayload { Alert = "Alert" }, }; Exception exception = null; try { var asyncTestHelper = new AsyncTestHelper(); service.Execute(request, respone => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); } catch (Exception e) { exception = e; } var remoteException = exception as RemoteException; Assert.IsNotNull(remoteException); Assert.AreEqual("{\"error_code\": 40001, \"details\": {\"device_tokens.0.device_token\": [\"device_token contains an invalid device token: BADTOKEN\"]}, \"error\": \"Data validation error\"}", remoteException.Message); }
public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { DeviceTokens = new List <string> { RemoteSettings.AppleDeviceId }, Payload = new PushPayload { Alert = "Alert" }, CustomData = new Dictionary <string, string> { { "Key", "Value" } } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { DeviceTokens = new List<string> { RemoteSettings.AppleDeviceId }, Payload = new PushPayload { Alert = "Alert" }, CustomData = new Dictionary<string, string> { {"Key", "Value"} } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Tags() { var service = new DeleteTagService { RequestBuilder = RequestBuilderHelper.Build() }; var helper = new AsyncTestHelper(); var request = new DeleteTagRequest {Tag = "myTag"}; service.Execute(request, response => helper.Callback(null), helper.HandleException); helper.Wait(); }
public void Tags() { var service = new DeleteTagService { RequestBuilder = RequestBuilderHelper.Build() }; var helper = new AsyncTestHelper(); var request = new DeleteTagRequest { Tag = "myTag" }; service.Execute(request, response => helper.Callback(null), helper.HandleException); helper.Wait(); }
public void Tags() { var service = new AddRegistrationService { RequestBuilder = RequestBuilderHelper.Build() }; var registration = new AddRegistrationRequest { PushId = RemoteSettings.AndroidPushId, Tags = new List<string> {"bangladesh"} }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(registration, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Tags() { var service = new RemoveTagFromDeviceService { RequestBuilder = RequestBuilderHelper.Build() }; var helper = new AsyncTestHelper(); var request = new RemoveTagFromDeviceRequest { DeviceToken = "DeviceId", TagToRemove = "tag1434" }; service.Execute(request, response => helper.Callback(null), helper.HandleException); helper.Wait(); }
public void TagToDevice() { var service = new AddTagToDeviceService { RequestBuilder = RequestBuilderHelper.Build() }; var asyncTestHelper = new AsyncTestHelper(); var request = new AddTagToDeviceRequest { DeviceToken = RemoteSettings.AppleDeviceId, Tag = "africa" }; service.Execute(request, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void ToTag() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { Tags = new List<string> {"africa"}, Payload = new PushPayload { Alert = "Alert 2" } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { PushIds = new List<string> {RemoteSettings.AndroidPushId}, Payload = new PushPayload { Alert = "Alert 2" } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new ModifyTagService { RequestBuilder = RequestBuilderHelper.Build() }; var tokens = new ModifyTagRequest { Tag = "myTag", AddDeviceTokens = new List<string> { RemoteSettings.AppleDeviceId }, }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(tokens, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Tags() { var service = new AddRegistrationService { RequestBuilder = RequestBuilderHelper.Build() }; var registration = new AddRegistrationRequest { PushId = RemoteSettings.AndroidPushId, Tags = new List <string> { "bangladesh" } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(registration, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new BroadcastService { RequestBuilder = RequestBuilderHelper.Build() }; var broadcastNotification = new BroadcastNotificationRequest { Payload = new PushPayload { Alert = "Alert 2", Badge = Badge.Increment() } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(broadcastNotification, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new ModifyTagService { RequestBuilder = RequestBuilderHelper.Build() }; var tokens = new ModifyTagRequest { Tag = "myTag", AddDeviceTokens = new List <string> { RemoteSettings.AppleDeviceId }, }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(tokens, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void ToTag() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { Tags = new List <string> { "africa" }, Payload = new PushPayload { Alert = "Alert 2" } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var pushNotification = new PushNotificationRequest { PushIds = new List <string> { RemoteSettings.AndroidPushId }, Payload = new PushPayload { Alert = "Alert 2" } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, x => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void ToAlias() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var random = new Random(); var pushNotification = new PushNotificationRequest { Aliases = new List<string>(new string[] { "1gzod" }), Payload = new PushPayload { Badge = random.Next(100), Alert = "What's up iPhone", } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void ToAlias() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var random = new Random(); var pushNotification = new PushNotificationRequest { Aliases = new List <string>(new string[] { "1gzod" }), Payload = new PushPayload { Badge = random.Next(100), Alert = "What's up iPhone", } }; var asyncTestHelper = new AsyncTestHelper(); service.Execute(pushNotification, response => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); }
public void Simple() { var service = new PushService { RequestBuilder = RequestBuilderHelper.Build() }; var request = new PushNotificationRequest { DeviceTokens = new List <string> { "BadToken" }, Payload = new PushPayload { Alert = "Alert" }, }; Exception exception = null; try { var asyncTestHelper = new AsyncTestHelper(); service.Execute(request, respone => asyncTestHelper.Callback(null), asyncTestHelper.HandleException); asyncTestHelper.Wait(); } catch (Exception e) { exception = e; } var remoteException = exception as RemoteException; Assert.IsNotNull(remoteException); Assert.AreEqual("{\"error_code\": 40001, \"details\": {\"device_tokens.0.device_token\": [\"device_token contains an invalid device token: BADTOKEN\"]}, \"error\": \"Data validation error\"}", remoteException.Message); }