Exemple #1
0
        public void Add_GivenException_ThenAddExceptionToNotificationList(
            Exception exception,
            HttpStatusCode statusCode)
        {
            // Arrange
            var notification = new Notification();

            // Act
            notification.Add(exception, (int)statusCode);

            // Assert
            notification.Any().Should().BeTrue();
        }
Exemple #2
0
        public void Add_GivenMessageAndStatusCode_ThenAddToNotificationList(
            string message,
            HttpStatusCode statusCode)
        {
            // Arrange
            var notification = new Notification();

            // Act
            notification.Add(message, (int)statusCode);

            // Assert
            notification.Any().Should().BeTrue();
        }
 internal void PrepareNotifications(Article article, string[] codes, bool disableNotifications = false)
 {
     Notifications = new Notification[0];
     ArticleIds    = new int[0];
     Articles      = new Article[0];
     ValidateCodes(codes);
     Codes = codes.Distinct().ToArray();
     if (!disableNotifications)
     {
         ContentId     = article.ContentId;
         SiteId        = article.Content.SiteId;
         Notifications = NotificationRepository.GetContentNotifications(ContentId, codes).ToArray();
         if (Notifications.Any())
         {
             Articles   = new[] { article };
             ArticleIds = new[] { article.Id };
         }
     }
 }
 internal void PrepareNotifications(int contentId, int[] articleIds, string[] codes, bool disableNotifications = false)
 {
     Notifications = new Notification[0];
     ArticleIds    = new int[0];
     Articles      = new Article[0];
     ValidateCodes(codes);
     Codes = codes.Distinct().ToArray();
     if (!disableNotifications)
     {
         ContentId     = contentId;
         SiteId        = ContentRepository.GetSiteId(contentId);
         Notifications = NotificationRepository.GetContentNotifications(contentId, codes).ToArray();
         if (Notifications.Any())
         {
             ArticleIds = articleIds;
             if (!Codes.Contains(NotificationCode.Create) && ServiceNotifications.Any())
             {
                 Articles = GetArticles();
             }
         }
     }
 }