Esempio n. 1
0
        public void Gets_preferences_for_delegate_when_user_type_is_delegate()
        {
            // Given
            var userType = UserType.DelegateUser;

            // When
            notificationPreferencesService.GetNotificationPreferencesForUser(userType, 1);

            // Then
            A.CallTo(() => notificationPreferencesDataService.GetNotificationPreferencesForDelegate(1))
            .MustHaveHappened(1, Times.Exactly);
        }
        public IEnumerable <NotificationPreference> GetNotificationPreferencesForUser(UserType userType, int?userId)
        {
            if (userType.Equals(UserType.AdminUser))
            {
                return(notificationPreferencesDataService.GetNotificationPreferencesForAdmin(userId));
            }

            if (userType.Equals(UserType.DelegateUser))
            {
                return(notificationPreferencesDataService.GetNotificationPreferencesForDelegate(userId));
            }

            throw new Exception($"No code path for getting notification preferences for user type {userType}");
        }