public Task ThenTheFirstNotificationStoredInTheTransientTenantForTheUserWithIdHasTheReadStatusForTheDeliveryChannelWithId(
     string userId,
     UserNotificationReadStatus expectedReadStatus,
     string deliveryChannelId)
 {
     return(this.ThenTheFirstNotificationsStoredInTheTransientTenantForTheUserWithIdHaveTheDeliveryStatusForTheDeliveryChannelWithId(1, userId, expectedReadStatus, deliveryChannelId));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BatchReadStatusUpdateRequestItem"/> class.
 /// </summary>
 /// <param name="notificationId">The <see cref="UpdateNotificationStatusRequestItem.NotificationId"/>.</param>
 /// <param name="newStatus">The <see cref="NewStatus" />.</param>
 /// <param name="updateTimestamp">The <see cref="UpdateNotificationStatusRequestItem.UpdateTimestamp" />.</param>
 /// <param name="deliveryChannelId">The <see cref="UpdateNotificationStatusRequestItem.DeliveryChannelId" />.</param>
 public BatchReadStatusUpdateRequestItem(
     string notificationId,
     UserNotificationReadStatus newStatus,
     DateTimeOffset updateTimestamp,
     string deliveryChannelId)
     : base(notificationId, updateTimestamp, deliveryChannelId)
 {
     this.NewStatus = newStatus;
 }
Пример #3
0
 /// <summary>
 /// Creates a new instance of the class with the read status to the specified value.
 /// </summary>
 /// <param name="existing">The <see cref="UserNotificationStatus" /> to create a modified copy of.</param>
 /// <param name="newStatus">The new read status.</param>
 /// <param name="effectiveDateTime">The time at which the update occurred.</param>
 /// <returns>An updated instance of the <see cref="UserNotificationStatus"/>.</returns>
 public static UserNotificationStatus WithReadStatus(
     this UserNotificationStatus existing,
     UserNotificationReadStatus newStatus,
     DateTimeOffset effectiveDateTime)
 {
     return(new UserNotificationStatus(
                existing.DeliveryChannelId,
                existing.DeliveryStatus,
                existing.DeliveryStatusLastUpdated,
                newStatus,
                effectiveDateTime.ToUniversalTime()));
 }
        public async Task ThenTheFirstNotificationsStoredInTheTransientTenantForTheUserWithIdHaveTheDeliveryStatusForTheDeliveryChannelWithId(
            int count,
            string userId,
            UserNotificationReadStatus expectedReadStatus,
            string deliveryChannelId)
        {
            GetNotificationsResult userNotifications = await this.GetNotificationsForUserAsync(userId, count).ConfigureAwait(false);

            foreach (UserNotification current in userNotifications.Results)
            {
                Assert.AreEqual(expectedReadStatus, current.GetReadStatusForChannel(deliveryChannelId));
            }
        }
Пример #5
0
 public UserNotificationStatus(
     string deliveryChannelId,
     UserNotificationDeliveryStatus deliveryStatus,
     DateTimeOffset deliveryStatusLastUpdated,
     UserNotificationReadStatus readStatus,
     DateTimeOffset readStatusLastUpdated)
 {
     this.DeliveryChannelId         = deliveryChannelId;
     this.DeliveryStatus            = deliveryStatus;
     this.DeliveryStatusLastUpdated = deliveryStatusLastUpdated.ToUniversalTime();
     this.ReadStatus            = readStatus;
     this.ReadStatusLastUpdated = readStatusLastUpdated.ToUniversalTime();
 }
        public Task WhenISendAManagementAPIRequestToBatchUpdateTheReadStatusOfTheFirstStoredNotificationsForUserToForTheDeliveryChannelWithId(int countToUpdate, string userId, UserNotificationReadStatus targetStatus, string deliveryChannelId)
        {
            // Get the notifications from session state
            List <UserNotification> notifications = this.scenarioContext.Get <List <UserNotification> >(DataSetupSteps.CreatedNotificationsKey);

            BatchReadStatusUpdateRequestItem[] requestBatch = notifications
                                                              .Where(n => n.UserId == userId)
                                                              .Take(countToUpdate)
                                                              .Select(
                n =>
                new BatchReadStatusUpdateRequestItem(
                    n.Id !,
                    targetStatus,
                    DateTimeOffset.UtcNow,
                    deliveryChannelId)).ToArray();

            string transientTenantId = this.featureContext.GetTransientTenantId();

            return(this.SendPostRequest(FunctionsApiBindings.ManagementApiBaseUri, $"/{transientTenantId}/marain/usernotifications/batchreadstatusupdate", requestBatch));
        }