public void Single() { var notification = new BroadcastNotificationRequest { Payload = new PushPayload { Alert = "My Alert", Sound = "My Sound", Badge = Badge.Increment() }, ExcludeTokens = new List <string> { "exclude1" }, }; var actual = notification.Serialize().FormatAsJson(); var expected = @" { 'aps': { 'alert': 'My Alert', 'badge': '+1', 'sound': 'My Sound' }, 'exclude_tokens': [ 'exclude1' ] }".Replace("\r\n", "\n"); Assert.AreEqual(expected, actual); }
public void Simple() { var service = new BroadcastService { RequestBuilder = ServerRequestBuilder.Instance }; var notification = new BroadcastNotificationRequest { ExcludeTokens = new List <string> { "TokenToExclude" }, Payload = new PushPayload { Alert = "Alert 2", Badge = Badge.Increment() } }; service.Execute(notification, response => Debug.WriteLine("Success"), ExceptionHandler.Handle); }
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(); }