public void Gets_preferences_for_admin_when_user_type_is_admin() { // Given var userType = UserType.AdminUser; // When notificationPreferencesService.GetNotificationPreferencesForUser(userType, 1); // Then A.CallTo(() => notificationPreferencesDataService.GetNotificationPreferencesForAdmin(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}"); }
public void Sets_notification_preferences_correctly_on_centre_manager_admin_registration() { using var transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); // Given var registrationModel = RegistrationModelTestHelper.GetDefaultCentreManagerRegistrationModel(); // When service.RegisterAdmin(registrationModel, false); // Then var user = userDataService.GetAdminUserByEmailAddress(registrationModel.Email) !; var preferences = notificationPreferencesDataService.GetNotificationPreferencesForAdmin(user.Id).ToList(); preferences.Count.Should().Be(7); preferences.Should().ContainSingle(n => n.NotificationId.Equals(1) && !n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(2) && n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(3) && n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(4) && !n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(5) && n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(6) && !n.Accepted); preferences.Should().ContainSingle(n => n.NotificationId.Equals(7) && !n.Accepted); }