Пример #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();
        }
Пример #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();
        }
Пример #3
0
 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 };
         }
     }
 }
Пример #4
0
 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();
             }
         }
     }
 }