Exemple #1
0
        public void MarkAsRead_WhenCalled_SetsIsReadToTrue()
        {
            // Arrange
            var notification     = Notification.FactoryGig(new Gig(), NotificationType.GigCancelled);
            var userNotification = new UserNotification(new ApplicationUser(), notification);

            // Act
            userNotification.MarkAsRead();

            // Assert
            Assert.AreEqual(true, userNotification.IsRead);
        }
        public void GetUnreadUserNotifications_NotificationIsRead_ShouldNotBeReturned()
        {
            // Arrange
            var notification = Notification.FactoryGig(new Gig(), NotificationType.GigCancelled);
            var userId       = "1";
            var user         = new ApplicationUser {
                Id = userId
            };
            var userNotification = new UserNotification(user, notification);

            userNotification.MarkAsRead();
            InitializeNotificationsRepository(new List <UserNotification>()
            {
                userNotification
            });

            // Act
            var notifications = _notificationsRepository.GetUnreadUserNotifications(userId);

            // Assert
            Assert.IsEmpty(notifications);
        }