private IMobilePushNotificationServiceClient CreateMobileServiceClient() { IMobilePushNotificationServiceClient client = Substitute.For <IMobilePushNotificationServiceClient>(); client .SendNotification(Arg.Any <MobileDevice>(), Arg.Any <PushNotification>()) .Returns(PushNotificationResult.Success(Constants.PushNotificationEndPoint)); return(client); }
public void SendInvalidEndPointPushNotificationTest() { NotificationTest test = new NotificationTest(); IMobilePushNotificationServiceClient mobileServiceClient = this.CreateMobileServiceClient(); PushNotificationChannel channel = new PushNotificationChannel(mobileServiceClient, test.EventPublisher); PushNotification notification = this.CreateNotification(); NotificationAccount <Guid> account = test.AddNotificationAccount(); this.PushNotificationShouldFailAtEndPoint(mobileServiceClient); channel.SendAsync(account, notification).Wait(); this.AssertSentFailed(test, account, notification, NotificationErrorCode.RouteFailure); }
/// <summary> /// Initializes a new instance of the PushNotificationChannel class. /// </summary> /// <param name="mobileNotificationServiceClient">Mobile notification service client.</param> /// <param name="eventPublisher">Event publisher.</param> public PushNotificationChannel(IMobilePushNotificationServiceClient mobileNotificationServiceClient, IEventPublisher eventPublisher) : base(eventPublisher) { this.mobileNotificationServiceClient = mobileNotificationServiceClient; }
private void PushNotificationShouldFailAtEndPoint(IMobilePushNotificationServiceClient client) { client .SendNotification(Arg.Any <MobileDevice>(), Arg.Any <PushNotification>()) .Returns(PushNotificationResult.Failed(Constants.PushNotificationEndPoint, "Invalid notification.")); }