コード例 #1
0
        private IMobilePushNotificationServiceClient CreateMobileServiceClient()
        {
            IMobilePushNotificationServiceClient client = Substitute.For <IMobilePushNotificationServiceClient>();

            client
            .SendNotification(Arg.Any <MobileDevice>(), Arg.Any <PushNotification>())
            .Returns(PushNotificationResult.Success(Constants.PushNotificationEndPoint));

            return(client);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
 private void PushNotificationShouldFailAtEndPoint(IMobilePushNotificationServiceClient client)
 {
     client
     .SendNotification(Arg.Any <MobileDevice>(), Arg.Any <PushNotification>())
     .Returns(PushNotificationResult.Failed(Constants.PushNotificationEndPoint, "Invalid notification."));
 }